From febea17f6aa9141b3a0044e9690d6e6501f5c9d3 Mon Sep 17 00:00:00 2001 From: zofia <110436990+zufangzhu@users.noreply.github.com> Date: Thu, 6 Aug 2026 15:40:44 +0800 Subject: [PATCH] =?UTF-8?q?[Model]=20Fix=20weight=20prefix=20mapping=20for?= =?UTF-8?q?=20native=20Qwen3.5=20text-only=20checkp=E2=80=A6=20(#50355)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zhu, Zufang Co-authored-by: opencode --- tests/models/registry.py | 6 +++++- vllm/model_executor/models/qwen3_5.py | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/models/registry.py b/tests/models/registry.py index e3b615dd7d..9872448992 100644 --- a/tests/models/registry.py +++ b/tests/models/registry.py @@ -502,7 +502,11 @@ _TEXT_GENERATION_EXAMPLE_MODELS = { "Qwen3ForCausalLM": _HfExamplesInfo("Qwen/Qwen3-8B"), "Qwen3MoeForCausalLM": _HfExamplesInfo("Qwen/Qwen3-30B-A3B"), "Qwen3_5ForCausalLM": _HfExamplesInfo("codecho/Qwen3.5-0.8B-text-only"), - "Qwen3_5MoeForCausalLM": _HfExamplesInfo("codecho/Qwen3.5-35B-A3B-text-only"), + "Qwen3_5MoeForCausalLM": _HfExamplesInfo( + "codecho/Qwen3.5-35B-A3B-text-only", + extras={"native-prefix": "imdatta0/small_qwen3_5_20b"}, + max_model_len=4096, + ), "MellumForCausalLM": _HfExamplesInfo("JetBrains/Mellum2-12B-A2.5B-Base"), "Qwen3NextForCausalLM": _HfExamplesInfo( "Qwen/Qwen3-Next-80B-A3B-Instruct", diff --git a/vllm/model_executor/models/qwen3_5.py b/vllm/model_executor/models/qwen3_5.py index 50b47f16fe..197b5315c5 100644 --- a/vllm/model_executor/models/qwen3_5.py +++ b/vllm/model_executor/models/qwen3_5.py @@ -303,6 +303,13 @@ class Qwen3_5ForCausalLMBase( "in_proj_ba": ["in_proj_b", "in_proj_a"], } + # Some community text-only checkpoints keep the extraneous + # `model.language_model.` prefix inherited from the VL training stack. + # Strip it so both prefixed and clean checkpoints load correctly. + hf_to_vllm_mapper = WeightsMapper( + orig_to_new_prefix={"model.language_model.": "model."}, + ) + def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""): config = vllm_config.model_config.hf_text_config self.vllm_config = vllm_config @@ -416,7 +423,7 @@ class Qwen3_5ForCausalLMBase( self, skip_prefixes=["mtp."], ) - return loader.load_weights(weights) + return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper) class Qwen3_5ForCausalLM(Qwen3_5ForCausalLMBase):