[RL] Honor tokenizer chat templates for base models that lack one#4049
Open
dasoto wants to merge 8 commits into
Open
[RL] Honor tokenizer chat templates for base models that lack one#4049dasoto wants to merge 8 commits into
dasoto wants to merge 8 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
6e6275f to
4957551
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem statement
Tokenizers loaded via
AutoTokenizer.from_pretrainedfor some model families (Gemma 4 base/IT, Llama 2 base, several others) havechat_template = None.utils_rl.process_datacallsapply_chat_template(...)unconditionally, causing a hardValueErrorcrash with no actionable error message.The SFT pipeline solves this by reading
config.chat_template(a Jinja string) or loading fromconfig.chat_template_pathviaload_chat_template_from_file, then attaching the result viavalidate_and_configure_sft_columns. The RL pipeline doesn't do any of this.Solution Proposed:
This PR clarifies and decouples the configuration fields for chat templates used during dataset preprocessing versus those loaded into the model tokenizer during Reinforcement Learning (RL) training workloads.
train_rl.pyto load dataset formats fromdata_template_pathand fallback tokenizer chat templates fromchat_template_path.data_template_pathfield and standard defaults.rl.ymlto use the new parameter names.train_rl_test.pyto reflect the renamed fields.TokenizerChatTemplateTestsuite to verify that tokenizers are successfully populated via Jinja strings or file paths.FIXES: b/519224406
Tests
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.