Skip to content

Commit f1c4328

Browse files
authored
update topk softmax (#985)
1 parent 44f3ff4 commit f1c4328

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lightllm/common/fused_moe/topk_select.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,13 @@ def fused_topk(
4141

4242
topk_weights = torch.empty(M, topk, dtype=torch.float32, device=hidden_states.device)
4343
topk_ids = torch.empty(M, topk, dtype=torch.int32, device=hidden_states.device)
44-
token_expert_indicies = torch.empty(M, topk, dtype=torch.int32, device=hidden_states.device)
4544

4645
sgl_ops.topk_softmax(
4746
topk_weights,
4847
topk_ids,
49-
token_expert_indicies,
5048
gating_output.float(), # TODO(woosuk): Optimize this.
49+
renormalize=renormalize,
5150
)
52-
del token_expert_indicies # Not used. Will be used in the future.
53-
54-
if renormalize:
55-
topk_weights = topk_weights / topk_weights.sum(dim=-1, keepdim=True)
56-
5751
return topk_weights, topk_ids
5852

5953

0 commit comments

Comments
 (0)