[Fix]: Restrict Kimi-K2.5 shared-experts fusion to Quark MXFP4 checkpoints (#25974)

This commit is contained in:
Jimmy Shong
2026-05-21 13:07:45 -07:00
committed by GitHub
parent 81d686d9fa
commit 1a85586738
+11 -1
View File
@@ -2450,9 +2450,19 @@ class DeepseekV2ForCausalLM(nn.Module, DeepseekV2WeightLoaderMixin):
# Allow-list of n_routed_experts values that have been validated
# for shared-experts fusion under this code path. Currently:
# 256 -> DeepSeek-V3 / R1
# 384 -> Kimi-K2.5 (text_config wraps DeepseekV3ForCausalLM)
# 384 -> Kimi-K2.5, only when the checkpoint is Quark MXFP4
# (amd/Kimi-K2.5-MXFP4); the standard
# moonshotai/Kimi-K2.5 (compressed-tensors) checkpoint
# stores the shared expert loose and is NOT pre-fused,
# so the fused path silently mis-loads it.
or self.config.n_routed_experts not in (256, 384)
or self.config.n_shared_experts != 1
or (
self.config.n_routed_experts == 384
and (
self.quant_config is None or self.quant_config.get_name() != "quark"
)
)
):
disable_reason = "Config does not support fused shared expert(s)."
elif (