[Cohere] Fix Cohere2MoE weight loading when using Transformers ≥5.10#44747
Merged
Conversation
Signed-off-by: Terrencezzj <terrence@cohere.ai>
Contributor
|
Hi @Terrencezzj, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
Contributor
Author
It's failed because of deepseekv4 |
mgoin
approved these changes
Jun 9, 2026
ekagra-ranjan
pushed a commit
to ekagra-ranjan/vllm
that referenced
this pull request
Jun 9, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai> Signed-off-by: Ekagra Ranjan <3116519+ekagra-ranjan@users.noreply.github.com>
waqahmed-amd-fi
pushed a commit
to waqahmed-amd-fi/vllm
that referenced
this pull request
Jun 10, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai> Signed-off-by: Waqar Ahmed <waqar.ahmed@amd.com>
Saddss
pushed a commit
to Saddss/vllm
that referenced
this pull request
Jun 14, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai>
vivek8123
pushed a commit
to odh-on-pz/vllm-upstream
that referenced
this pull request
Jun 18, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai>
divineearthly
pushed a commit
to divineearthly/vllm
that referenced
this pull request
Jun 19, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai> Signed-off-by: divineearthly <divineearthly@gmail.com>
tunglinwood
pushed a commit
to tunglinwood/vllm
that referenced
this pull request
Jun 22, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai>
1 task
nkzhenhua
pushed a commit
to nkzhenhua/vllm
that referenced
this pull request
Jun 24, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai>
ohsono
pushed a commit
to ohsono/vllm
that referenced
this pull request
Jul 3, 2026
…llm-project#44747) Signed-off-by: Terrencezzj <terrence@cohere.ai>
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.
Problem
Cohere2MoeDecoderLayerandCohere2MoeAttentionrelied ongetattr(config, "first_k_dense_replace", 0)to decide whether a layer uses a dense MLP or MoE.Under Transformers 5.10+,
Cohere2MoeConfigconsumesfirst_k_dense_replaceand setsmlp_layer_types = ["dense", "sparse", ...], leavingfirst_k_dense_replaceas None. vLLM then defaulted to 0, built layer 0 as MoE, and failed to load checkpoints with dense layer-0 weights:Fix
Cohere2MoeModel(before make_layers): ifmlp_layer_typesis absent, derive it from legacyfirst_k_dense_replace, otherwise default to all "sparse"Test Plan
Test Result
Deterministic generation produces identical output under Transformers 5.9.0 and 5.10.2
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.