-
Notifications
You must be signed in to change notification settings - Fork 47
[BUGFIX]Fix tokenizer bug when getting action masks with enable_thinking arguments #316
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
[BUGFIX]Fix tokenizer bug when getting action masks with enable_thinking arguments #316
Conversation
Summary of ChangesHello @garyzhang99, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical tokenization bug that caused the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request addresses a bug in the tokenizer that caused misaligned assistant action masks when enable_thinking was used. The fix involves adding the enable_thinking parameter to the tokenize_and_mask_messages_hf and tokenize_and_mask_messages_default functions and passing it down to the tokenizer.apply_chat_template method. The vLLMRolloutModel is also updated to pass its enable_thinking configuration to these functions. The changes are correct and well-targeted. I've suggested updating the docstrings for the modified functions to include the new parameter, which will improve code maintainability. Overall, this is a good fix.
|
/unittest-all |
Summary
Failed Tests
Skipped
Tests
Github Test Reporter by CTRF 💚 |
|
/unittest-module-manager |
Summary
Tests
Github Test Reporter by CTRF 💚 |
Description
Fixes a bug where the
assistant_token_maskwas misaligned. The method did not correctly handle special tokens added byenable_thinking=False, causing an offset. This will lead to incorrect results when using the qwen3 model while settingenable_thinking=False.For example, the correct unmasked token should be:
Instead we get the unmasked token as:
and the action masked tokens:
Causing an offset.
Checklist
Please check the following items before code is ready to be reviewed.