Skip to content

Conversation

@kaysonyu
Copy link
Contributor

@kaysonyu kaysonyu commented Jan 4, 2026

Summary

This PR removes the --apply-chat-template flag from scripts/run-qwen3-235B-A22B-sft.sh to align it with the fix made in PR #1307.

Root Cause

The --apply-chat-template flag should not be used in SFT training because:

  1. MultiTurnLossMaskGenerator.get_loss_mask() expects messages in list format (list of dicts with role and content keys)
  2. When --apply-chat-template is enabled during the Dataset loading phase, it converts messages to a string format via tokenizer.apply_chat_template()
  3. This causes get_loss_mask() to fail since it needs to iterate through messages to generate proper loss masks for assistant responses
  4. The tokenizer.apply_chat_template() should be called internally by MultiTurnLossMaskGenerator, not during data loading

Changes

  • Comment out --apply-chat-template in scripts/run-qwen3-235B-A22B-sft.sh (line 52)

@kaysonyu kaysonyu force-pushed the fix-apply-chat-template branch from d5a1057 to 9b2ac54 Compare January 4, 2026 05:33
@zhuzilin zhuzilin merged commit 6883db8 into THUDM:main Jan 5, 2026
@kaysonyu kaysonyu deleted the fix-apply-chat-template branch January 5, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants