[Qwen3.5 MoE] Add _tp_plan to ForConditionalGeneration#45124
Merged
ArthurZucker merged 1 commit intohuggingface:mainfrom Apr 2, 2026
Merged
[Qwen3.5 MoE] Add _tp_plan to ForConditionalGeneration#45124ArthurZucker merged 1 commit intohuggingface:mainfrom
ArthurZucker merged 1 commit intohuggingface:mainfrom
Conversation
The VL wrapper class was missing `_tp_plan`, so `lm_head` was not sharded when using `tp_plan="auto"`. The text-only `ForCausalLM` already had this; this aligns the conditional-generation (VL) variant.
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: qwen3_5_moe |
2 tasks
marvinzh
pushed a commit
to marvinzh/transformers
that referenced
this pull request
Apr 3, 2026
…5124) [Qwen3.5 MoE] Add `_tp_plan` to `Qwen3_5MoeForConditionalGeneration` The VL wrapper class was missing `_tp_plan`, so `lm_head` was not sharded when using `tp_plan="auto"`. The text-only `ForCausalLM` already had this; this aligns the conditional-generation (VL) variant.
SangbumChoi
pushed a commit
to SangbumChoi/transformers
that referenced
this pull request
Apr 4, 2026
…5124) [Qwen3.5 MoE] Add `_tp_plan` to `Qwen3_5MoeForConditionalGeneration` The VL wrapper class was missing `_tp_plan`, so `lm_head` was not sharded when using `tp_plan="auto"`. The text-only `ForCausalLM` already had this; this aligns the conditional-generation (VL) variant.
sirzechs66
pushed a commit
to sirzechs66/transformers
that referenced
this pull request
Apr 18, 2026
…5124) [Qwen3.5 MoE] Add `_tp_plan` to `Qwen3_5MoeForConditionalGeneration` The VL wrapper class was missing `_tp_plan`, so `lm_head` was not sharded when using `tp_plan="auto"`. The text-only `ForCausalLM` already had this; this aligns the conditional-generation (VL) variant.
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 does this PR do?
Adds
_tp_plan = {"lm_head": "colwise_gather_output"}toQwen3_5MoeForConditionalGeneration(the VL wrapper class).The text-only
Qwen3_5MoeForCausalLMalready had_tp_plan, but the VL variant was missing it. This meant that when usingtp_plan="auto", thelm_headon the VL model was not sharded — each GPU held a full copy and the all-gather behavior (colwise_gather_output) was not applied, which could produce incorrect logits under tensor parallelism.Change: Applied in
modular_qwen3_5_moe.py(source of truth) and regeneratedmodeling_qwen3_5_moe.py.Already in place (no changes needed):
base_model_tp_planonQwen3_5MoeTextConfigcovers full attention (q/k/v/o_proj, q/k_norm), MoE experts, and shared experts.Out of scope (future work):
causal_conv1dDTensor support.Fixes #45125
Code Agent Policy
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@3outeille @ArthurZucker (distributed / model loading)