fix(geo3k-vlm-sft): remove --apply-chat-template from SFT launch script#1791
Merged
zhuzilin merged 1 commit intoTHUDM:mainfrom Apr 3, 2026
Merged
Conversation
--apply-chat-template flattens the messages list into a plain string, stripping the role boundaries that the SFT rollout needs to build the per-token loss mask. With the flag present, user/system tokens are included in the loss — the model trains on the wrong tokens. The sft_rollout.generate_rollout() expects messages as a structured list so it can identify assistant turns and mask everything else out. Removing the flag restores correct SFT loss masking behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
--apply-chat-templateinrun_geo3k_vlm_sft.shconverts themessageslist into a plain string before it reaches the SFT rollout.sft_rollout.generate_rollout()expectssample.promptto be a list of message dicts, so passing a string causes a TypeError at runtime — training fails immediately.Fix
Remove the flag. The
messagescolumn produced byprepare_sft_data.pyis already a structured list; the SFT rollout consumes it directly to build the per-token loss mask.