[Bugfix] Load stacked expert weights for non-gated MoE (#59031)

Signed-off-by: Roi Koren <roik@nvidia.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
roikoren755
2026-10-05 15:26:55 +03:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 4ff028d77e
commit 51eeb0c58f
6 changed files with 88 additions and 18 deletions
+2 -4
View File
@@ -409,13 +409,11 @@ def process_packed_modules_mapping(
"experts.w3",
]
elif (not model.is_3d_moe_weight) or force_2d_moe:
# Filter out malformed entries: non-gated MoE has empty
# ckpt_up_proj_name which results in weight_name containing ".."
# (e.g., "experts.0.." instead of "experts.0.layer_name.")
# Non-gated MoE yields two entries per expert (no w3); the
# manager pads them to triplets before packing.
packed_modules_mapping["experts"] = [
weight_name.rstrip(".")
for _, weight_name, _, _ in get_moe_expert_mapping(model)
if ".." not in weight_name
]
return packed_modules_mapping