Reorder loop in shared expert weight loading (#5719)

This commit is contained in:
Ke Bao
2025-04-25 17:27:42 -07:00
committed by GitHub
parent 269c457e05
commit c3948ba67e
2 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -215,11 +215,11 @@ class DeepseekV3ForCausalLMNextN(DeepseekV3ForCausalLM):
"up_proj.weight_scale_inv",
]
names_to_remove = []
for num_repeat in range(self.n_share_experts_fusion):
for suffix in suffix_list:
shared_expert_weight_name = (
f"model.layers.0.mlp.shared_experts.{suffix}"
)
for suffix in suffix_list:
shared_expert_weight_name = (
f"model.layers.0.mlp.shared_experts.{suffix}"
)
for num_repeat in range(self.n_share_experts_fusion):
weights_list.append(
(
f"model.layers.0."
@@ -229,7 +229,7 @@ class DeepseekV3ForCausalLMNextN(DeepseekV3ForCausalLM):
weights_dict[shared_expert_weight_name],
)
)
names_to_remove += [shared_expert_weight_name]
names_to_remove += [shared_expert_weight_name]
weights = [w for w in weights_list if w[0] not in names_to_remove]
# Params for weights, fp8 weight scales, fp8 activation scales