-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Fix Llama 3 TikToken conversion #33538
Conversation
@@ -332,7 +332,7 @@ def permute(w, n_heads, dim1=dim, dim2=dim): | |||
|
|||
class Llama3Converter(TikTokenConverter): | |||
def __init__(self, vocab_file, special_tokens=None, instruct=False, model_max_length=None, **kwargs): | |||
super().__init__(vocab_file, **kwargs) | |||
super().__init__(vocab_file, additional_special_tokens=special_tokens, **kwargs) |
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.
Line 348 below could possibly be removed, as the superclass will handle it.
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.
Yes agreed it can be removed! Thanks
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.
Good catch and indeed since now it is natively supported let's use super's functionalities!
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
* Fix Llama 3 TikToken conversion * No need to add tokens again
What does this PR do?
Fixes a tokenizer conversion problem for Llama 3, possibly introduced in #31656
How to reproduce:
The following fails in
main
and works with this PR:The same issue may happen with Gemma models as well. I didn't test yet, but can verify once we agree on a suitable approach.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@itazap @ArthurZucker