fix: correct weight loading prefix mapping for Qwen3-VL (#18024)
Co-authored-by: liuxiaoming <liuxiaoming@modelbest.cn> Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user