[Model] Fix weight prefix mapping for native Qwen3.5 text-only checkp… (#50355)
Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com> Co-authored-by: opencode <opencode@anomaly.co>
zofia committed
Aug 6, 2026 at 15:40 UTC
febea17f6aa9141b3a0044e9690d6e6501f5c9d3
2 files changed
+13
-2
tests/models/registry.py
+5
-1
@@ -502,7 +502,11 @@ _TEXT_GENERATION_EXAMPLE_MODELS = {
502
"Qwen3ForCausalLM": _HfExamplesInfo("Qwen/Qwen3-8B"),
503
"Qwen3MoeForCausalLM": _HfExamplesInfo("Qwen/Qwen3-30B-A3B"),
504
"Qwen3_5ForCausalLM": _HfExamplesInfo("codecho/Qwen3.5-0.8B-text-only"),
505
- "Qwen3_5MoeForCausalLM": _HfExamplesInfo("codecho/Qwen3.5-35B-A3B-text-only"),
505
+ "Qwen3_5MoeForCausalLM": _HfExamplesInfo(
506
+ "codecho/Qwen3.5-35B-A3B-text-only",
507
+ extras={"native-prefix": "imdatta0/small_qwen3_5_20b"},
508
+ max_model_len=4096,
509
+ ),
510
"MellumForCausalLM": _HfExamplesInfo("JetBrains/Mellum2-12B-A2.5B-Base"),
511
"Qwen3NextForCausalLM": _HfExamplesInfo(
512
"Qwen/Qwen3-Next-80B-A3B-Instruct",
vllm/model_executor/models/qwen3_5.py
+8
-1
@@ -303,6 +303,13 @@ class Qwen3_5ForCausalLMBase(
303
"in_proj_ba": ["in_proj_b", "in_proj_a"],
304
}
305
306
+ # Some community text-only checkpoints keep the extraneous
307
+ # `model.language_model.` prefix inherited from the VL training stack.
308
+ # Strip it so both prefixed and clean checkpoints load correctly.
309
+ hf_to_vllm_mapper = WeightsMapper(
310
+ orig_to_new_prefix={"model.language_model.": "model."},
311
+ )
312
+
313
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
314
config = vllm_config.model_config.hf_text_config
315
self.vllm_config = vllm_config
@@ -416,7 +423,7 @@ class Qwen3_5ForCausalLMBase(
423
self,
424
skip_prefixes=["mtp."],
425
)
419
- return loader.load_weights(weights)
426
+ return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
427
428
429
class Qwen3_5ForCausalLM(Qwen3_5ForCausalLMBase):