[bugfix] fix qwen3_tts#9721
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the loss calculation for the Qwen TTS model by removing the labels argument from the talker forward pass in swift/model/models/qwen.py and manually computing the cross-entropy loss in swift/template/templates/qwen.py. Feedback highlights a critical bug in qwen.py where the wrong hidden states layer is accessed and the batch dimension is discarded, as well as an opportunity in templates/qwen.py to scale the loss by num_items_in_batch for correct gradient scaling in distributed training.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
#9715
QwenLM/Qwen3-TTS#278