Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions lightllm/common/fused_moe/topk_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,13 @@ def fused_topk(

topk_weights = torch.empty(M, topk, dtype=torch.float32, device=hidden_states.device)
topk_ids = torch.empty(M, topk, dtype=torch.int32, device=hidden_states.device)
token_expert_indicies = torch.empty(M, topk, dtype=torch.int32, device=hidden_states.device)

sgl_ops.topk_softmax(
topk_weights,
topk_ids,
token_expert_indicies,
gating_output.float(), # TODO(woosuk): Optimize this.
renormalize=renormalize,
)
Comment on lines 45 to 50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The sgl_ops.topk_softmax function signature has changed, now including renormalize as an argument. The test file unit_tests/common/fused_moe/test_softmax_topk.py needs to be updated to reflect this change, otherwise the tests will fail with a TypeError.

Please update the unit tests in unit_tests/common/fused_moe/test_softmax_topk.py to use the new API.

del token_expert_indicies # Not used. Will be used in the future.

if renormalize:
topk_weights = topk_weights / topk_weights.sum(dim=-1, keepdim=True)

return topk_weights, topk_ids


Expand Down