[NPU] Determine the topk norm_type through scoring_func (#31107)
Co-authored-by: iridiumine <42236072+iridiumine@users.noreply.github.com> Co-authored-by: zhaozx-cn <59479021+zhaozx-cn@users.noreply.github.com> Co-authored-by: sglang-npu-bot <sglangnpu@163.com>
This commit is contained in:
co-authored by
iridiumine
zhaozx-cn
sglang-npu-bot
parent
dec0836302
commit
241937af87
@@ -97,7 +97,7 @@ def fused_topk_npu(
|
||||
group_select_mode=(1 if use_grouped_topk else 0),
|
||||
renorm=0,
|
||||
# 1 for sigmoid, 0 for softmax
|
||||
norm_type=1,
|
||||
norm_type=(0 if topk_config.scoring_func == "softmax" else 1),
|
||||
routed_scaling_factor=(
|
||||
topk_config.routed_scaling_factor
|
||||
if topk_config.apply_routed_scaling_factor_on_output
|
||||
|
||||
@@ -225,6 +225,7 @@ class Glm4MoeLiteSparseMoeBlock(nn.Module):
|
||||
quant_config=quant_config,
|
||||
routed_scaling_factor=self.routed_scaling_factor,
|
||||
prefix=add_prefix("experts", prefix),
|
||||
**({"scoring_func": "sigmoid"}),
|
||||
)
|
||||
|
||||
self.topk = TopK(
|
||||
|
||||
Reference in New Issue
Block a user