fix(qwen3_omni): read router_aux_loss_coef from text_config#9763
Open
Anai-Guo wants to merge 1 commit into
Open
fix(qwen3_omni): read router_aux_loss_coef from text_config#9763Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
In the Qwen3-Omni thinker forward, the MoE auxiliary-loss coefficient was read from the top-level composite config (self.config.router_aux_loss_coef), but the router hyperparameters live in the thinker'"'"'s text_config. The sibling router setting output_router_logits is already read from self.config.text_config, and vocab_size uses self.config.get_text_config(), so this was the lone inconsistent access. Align it with text_config so the aux-loss term is scaled by the correct coefficient.
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
What / Why
In the Qwen3-Omni thinker
forward(swift/model/models/qwen.py), the MoEauxiliary-loss coefficient is read from the top-level composite config:
For the Qwen3-Omni thinker, the router hyperparameters live in the thinker's
text_config, not on the top-level composite config. The two sibling accessesin the same function already go through
text_config:output_router_logits→self.config.text_config.output_router_logitsvocab_size→self.config.get_text_config().vocab_sizeso
router_aux_loss_coefwas the lone inconsistent access. Reading it off thecomposite config scales the aux-loss term with the wrong coefficient (and can
AttributeErrorwhen the attribute is absent at the top level).Fix
Read the coefficient from
text_config, matching the siblingoutput_router_logitsaccess:Fixes #9757
🤖 Generated with Claude Code