-
Notifications
You must be signed in to change notification settings - Fork 310
ElectraTokenizer #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ElectraTokenizer #1357
Conversation
|
Please check the tests! Looks like some legitimate failures. |
|
I'll be out next week, so tagged @tirthasheshpatel and @nkovela1 to take a look. |
|
|
||
|
|
||
| @keras_nlp_export("keras_nlp.models.ElectraTokenizer") | ||
| class ElectraTokenizer(WordPieceTokenizer): |
There was a problem hiding this comment.
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."))
tirthasheshpatel
left a comment
There was a problem hiding this 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!
|
Merged, thanks @pranavvp16! |
I have added the electratokenizer . notebook demonstrating that tokens match