-
Notifications
You must be signed in to change notification settings - Fork 693
Update to proper EOS ids for Qwen2 and Qwen2.5 #2342
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
Update to proper EOS ids for Qwen2 and Qwen2.5 #2342
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2342
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 6f01c17 with merge base 059cad9 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| prompt_template: Optional[PromptTemplate] = None, | ||
| errors: str = "replace", | ||
| unk_token: Optional[str] = ENDOFTEXT, | ||
| unk_token: Optional[str] = None, |
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.
why did we need this before?
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.
I don't think we did. It was just incorrectly set.
| self.im_start_id = self.special_tokens[IM_START] | ||
| self.im_end_id = self.special_tokens[IM_END] | ||
| self.stop_tokens = [self.eos_id, self.im_end_id] | ||
| self.stop_tokens = [self.eos_id, self.pad_id] |
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.
was "self.pad_id" not here also a bug?
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.
No b/c eos_id was set to the pad_id. So now it's the same values, but proper references.
|
did you have a chance to reproduce the python code detailed in the ticket and make sure the output is correct now? I can approve after that |
I confirm that when I run the code on the ticket, I get the following output, which is correct according to the code on Hugging Face: |
Context
What is the purpose of this PR? Is it to
As detailed in #2337, the ending token for Qwen2 and Qwen2.5 should actually be "<|im_end|>", not "<|endoftext|>". This fixes that and updates tests accordingly.
Qwen2 tokenizer source
Qwen2.5 tokenizer source
Changelog
What are the changes made in this PR?
Test plan
Please make sure to do each of the following if applicable to your PR. If you're unsure about any one of these just ask and we will happily help. We also have a contributing page for some guidance on contributing.
pre-commit install)pytest testspytest tests -m integration_testUX
If your function changed a public API, please add a dummy example of what the user experience will look like when calling it.
Here is a docstring example
and a tutorial example