From 522e13b4d2c1de1cfb44ecbbca374ec8f312de52 Mon Sep 17 00:00:00 2001 From: Xiaoming Liu Date: Mon, 2 Feb 2026 13:50:21 +0800 Subject: [PATCH] fix: correct weight loading prefix mapping for Qwen3-VL (#18024) Co-authored-by: liuxiaoming Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com> --- python/sglang/srt/models/qwen3_vl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/models/qwen3_vl.py b/python/sglang/srt/models/qwen3_vl.py index 54d224b24..89de28da6 100644 --- a/python/sglang/srt/models/qwen3_vl.py +++ b/python/sglang/srt/models/qwen3_vl.py @@ -959,7 +959,13 @@ class Qwen3VLForConditionalGeneration(nn.Module): name = name.replace(r"model.language_model.", r"model.") layer_id = get_layer_id(name) - if self.pp_group.is_last_rank and "model.embed_tokens.weight" in name: + # Only copy embed_tokens to lm_head when tie_word_embeddings=True + # For models with tie_word_embeddings=False (e.g. 8B), lm_head has independent weights + if ( + self.pp_group.is_last_rank + and "model.embed_tokens.weight" in name + and self.config.tie_word_embeddings + ): if "lm_head.weight" in params_dict: lm_head_param = params_dict["lm_head.weight"] weight_loader = getattr(