[NPU] Fix the DeepSeek-V2-Coder model accuracy issue (#29042)

This commit is contained in:
看海的人
2026-06-25 09:14:32 +08:00
committed by GitHub
parent 4e155ecc31
commit 67b2a9ed0c
3 changed files with 4 additions and 1 deletions
@@ -83,7 +83,8 @@ def fused_topk_npu(
group_count=topk_config.num_expert_group if use_grouped_topk else 1,
group_select_mode=(1 if use_grouped_topk else 0),
renorm=0,
norm_type=1, # 1 for sigmoid, 0 for softmax
# 1 for sigmoid, 0 for softmax
norm_type=(0 if topk_config.scoring_func == "softmax" else 1),
routed_scaling_factor=(
1 if renormalize else topk_config.routed_scaling_factor
),
+1
View File
@@ -658,6 +658,7 @@ class DeepseekV2MoE(nn.Module):
num_expert_group=config.n_group,
num_fused_shared_experts=self.num_fused_shared_experts,
topk_group=config.topk_group,
scoring_func=config.scoring_func,
correction_bias=self.gate.e_score_correction_bias,
quant_config=quant_config,
routed_scaling_factor=self.routed_scaling_factor,
+1
View File
@@ -262,6 +262,7 @@ class LLaDA2MoeSparseMoeBlock(nn.Module):
# num_fused_shared_experts=self.num_fused_shared_experts,
topk_group=self.topk_group,
correction_bias=self.correction_bias,
scoring_func=self.score_function,
routed_scaling_factor=self.routed_scaling_factor,
)