[NPU] Fix the DeepSeek-V2-Coder model accuracy issue (#29042)
This commit is contained in:
@@ -83,7 +83,8 @@ def fused_topk_npu(
|
|||||||
group_count=topk_config.num_expert_group if use_grouped_topk else 1,
|
group_count=topk_config.num_expert_group if use_grouped_topk else 1,
|
||||||
group_select_mode=(1 if use_grouped_topk else 0),
|
group_select_mode=(1 if use_grouped_topk else 0),
|
||||||
renorm=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=(
|
routed_scaling_factor=(
|
||||||
1 if renormalize else topk_config.routed_scaling_factor
|
1 if renormalize else topk_config.routed_scaling_factor
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -658,6 +658,7 @@ class DeepseekV2MoE(nn.Module):
|
|||||||
num_expert_group=config.n_group,
|
num_expert_group=config.n_group,
|
||||||
num_fused_shared_experts=self.num_fused_shared_experts,
|
num_fused_shared_experts=self.num_fused_shared_experts,
|
||||||
topk_group=config.topk_group,
|
topk_group=config.topk_group,
|
||||||
|
scoring_func=config.scoring_func,
|
||||||
correction_bias=self.gate.e_score_correction_bias,
|
correction_bias=self.gate.e_score_correction_bias,
|
||||||
quant_config=quant_config,
|
quant_config=quant_config,
|
||||||
routed_scaling_factor=self.routed_scaling_factor,
|
routed_scaling_factor=self.routed_scaling_factor,
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ class LLaDA2MoeSparseMoeBlock(nn.Module):
|
|||||||
# num_fused_shared_experts=self.num_fused_shared_experts,
|
# num_fused_shared_experts=self.num_fused_shared_experts,
|
||||||
topk_group=self.topk_group,
|
topk_group=self.topk_group,
|
||||||
correction_bias=self.correction_bias,
|
correction_bias=self.correction_bias,
|
||||||
|
scoring_func=self.score_function,
|
||||||
routed_scaling_factor=self.routed_scaling_factor,
|
routed_scaling_factor=self.routed_scaling_factor,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user