transformers
f3247073 - Honor `config.output_router_logits` in the MoE VLM wrappers (#48885)

Commit
64 days ago
Honor `config.output_router_logits` in the MoE VLM wrappers (#48885) * Honor `config.output_router_logits` in the MoE VLM wrappers Four `ForConditionalGeneration` wrappers read the flag straight off `kwargs` instead of resolving it against the config, so setting `config.output_router_logits = True` did nothing and only a forward argument turned the auxiliary loss on: Qwen3-VL-MoE, GLM4V-MoE, Qwen3.5-MoE and Qwen4-Exp. Every text-only MoE honors both, Qwen3-MoE being the reference. Resolve the argument against the text config before the backbone call, as `Qwen3MoeForCausalLM` does, and pass it down explicitly. Two modular files cover all four, since Qwen3.5-MoE and Qwen4-Exp inherit the wrapper from Qwen3-VL-MoE. `Qwen3VLMoeTextConfig` had `output_router_logits` deleted in #41250 because nothing read it, and `Glm4vMoeTextConfig` never had it, inheriting from the auxiliary-loss-free `Glm4MoeConfig`. Both need it now, so restore one and add the other. * Wire the auxiliary loss through the MiniMax-M3-VL wrapper Same gap as the other four, one step further along. `MiniMaxM3VLTextForCausalLM` implements the auxiliary loss in full, while `MiniMaxM3SparseForConditionalGeneration` has no `output_router_logits` argument and no auxiliary-loss block, and neither of its output types carries `aux_loss`. Add the argument and resolve it against the text config like the others, carry `router_logits` through the backbone output instead of dropping it when the output is rebuilt, and add `aux_loss` and `router_logits` to the output types. * Test config-driven router logits in the common mixin instead of per model * Resolve output_router_logits against the config in JetMoe, use the decoder text config in the common test
Author
Parents
Loading