[Bugfix] Fix Deepseek v4 non-mega-moe model init error (#44356)

Signed-off-by: wzhao18 <wzhao18.sz@gmail.com>
This commit is contained in:
Wei Zhao
2026-06-02 18:26:30 -07:00
committed by GitHub
parent ca17b6b17d
commit 969aec4bc8
+8
View File
@@ -620,6 +620,14 @@ class DeepseekV4MoE(nn.Module):
self.experts_start_idx = self.tp_rank * self.n_local_experts
self.experts_end_idx = self.experts_start_idx + self.n_local_experts
self.n_redundant_experts = 0
self.n_shared_experts = config.n_shared_experts or 0
self.n_logical_experts = self.n_routed_experts
self.n_physical_experts = self.n_logical_experts
self.n_local_physical_experts = self.n_local_experts
self.physical_expert_start = self.experts_start_idx
self.physical_expert_end = self.experts_end_idx
self.experts = FusedMoE(
shared_experts=self.shared_experts,
gate=self.gate,