Skip to content

Decouple Retokenize and Custom Chat Template#351

Open
devpatelio wants to merge 65 commits intoNovaSky-AI:mainfrom
devpatelio:devpatel/skyrl-issue-179
Open

Decouple Retokenize and Custom Chat Template#351
devpatelio wants to merge 65 commits intoNovaSky-AI:mainfrom
devpatelio:devpatel/skyrl-issue-179

Conversation

@devpatelio
Copy link
Collaborator

@devpatelio devpatelio commented Sep 26, 2025

Addresses #179: Separate configuration of cfg.generator.retokenize and cfg.generator.custom_chat_template
Note, this branch is an extension of this PR for improving the custom chat template endpoint flexibility (#178)

Separate configuration of cfg.generator.retokenize and cfg.generator.custom_chat_template
Currently, prior to this PR, having a custom_chat_template means that we always retokenize chat history, rather than performing token-in-token-out style of appending tokens. But these behaviors should be decoupled. Refer to https://skyrl.readthedocs.io/en/latest/tutorials/skyrl_gym_generator.html for more details.

devpatelio and others added 30 commits August 23, 2025 01:12
… commits as right now, users have to manually add in parser support). Provided thinking masking on/off support for Qwen3 Models
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…_templating.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…om_chat_template endpoint to ensure tests are aligned
…or no chat template selection, brought it back
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 effectively decouples the retokenize and custom_chat_template configurations by introducing a more flexible chat_template config structure and a separate retokenize boolean flag. The changes in skyrl_train/generators/utils.py to handle template loading are a significant improvement. However, I've identified a critical issue where an old assertion was missed during refactoring, which will lead to a runtime error and undermines the decoupling effort. Additionally, a unit test intended to cover the retokenization path is now broken due to the logic changes. My review includes specific suggestions to address these points.

@devpatelio
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 effectively decouples the retokenize and custom_chat_template configurations, which is a great improvement for flexibility. The implementation is solid, with new configuration options in ppo_base_config.yaml and updated logic in skyrl_gym_generator.py and utils.py. The tests have also been updated to cover the new functionality, including loading templates from files.

I have a few suggestions to improve code clarity and robustness, mainly around configuration handling and variable naming. I've also noted a minor point about a new test file and an outdated TODO comment.

devpatelio and others added 4 commits September 26, 2025 14:42
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments