[bug fix][pp] fix weight load for qwen2.5-vl (#15138)

Signed-off-by: Xuchun Shang <xuchun.shang@gmail.com>
This commit is contained in:
Xuchun Shang
2025-12-17 18:33:50 +08:00
committed by GitHub
parent ffa7e03506
commit 0071fe9c40

View File

@@ -761,6 +761,14 @@ class Qwen2_5_VLForConditionalGeneration(nn.Module):
if "rotary_emb.inv_freq" in name:
continue
if self.pp_group.is_last_rank and "model.embed_tokens.weight" in name:
if "lm_head.weight" in params_dict:
lm_head_param = params_dict["lm_head.weight"]
weight_loader = getattr(
lm_head_param, "weight_loader", default_weight_loader
)
weight_loader(lm_head_param, loaded_weight)
for param_name, weight_name, shard_id in stacked_params_mapping:
if weight_name not in name:
continue
@@ -807,10 +815,8 @@ class Qwen2_5_VLForConditionalGeneration(nn.Module):
if name in params_dict.keys():
param = params_dict[name]
else:
if get_global_server_args().encoder_only:
continue
else:
raise ValueError(f"Weight {name} not found in params_dict")
continue
except KeyError:
print(params_dict.keys())
raise