Skip to content

Conversation

@pranavvp16
Copy link
Contributor

I have added the electratokenizer . notebook demonstrating that tokens match

@mattdangerw
Copy link
Member

Please check the tests! Looks like some legitimate failures.

@mattdangerw
Copy link
Member

I'll be out next week, so tagged @tirthasheshpatel and @nkovela1 to take a look.

@tirthasheshpatel tirthasheshpatel added the kokoro:force-run Runs Tests on GPU label Dec 15, 2023
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Dec 15, 2023


@keras_nlp_export("keras_nlp.models.ElectraTokenizer")
class ElectraTokenizer(WordPieceTokenizer):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are exporting this class, can you add an example on how to use this? Something like:

    vocab = ["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"]
    vocab += ["The", "quick", "brown", "fox", "jumped", "."]

    # Instantiate the tokenizer.
    tokenizer = keras_nlp.models.ElectraTokenizer(vocabulary=vocab)

    # Unbatched input.
    tokenizer("The quick brown fox jumped.")

    # Batched input.
    tokenizer(["The quick brown fox jumped.", "The fox slept."])

    # Detokenization.
    tokenizer.detokenize(tokenizer("The quick brown fox jumped."))

Copy link
Contributor

@tirthasheshpatel tirthasheshpatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except one minor comment. Thanks for the PR @pranavvp16!

@tirthasheshpatel tirthasheshpatel merged commit f78276f into keras-team:master Dec 16, 2023
@tirthasheshpatel
Copy link
Contributor

Merged, thanks @pranavvp16!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants