Fix zero expert routed ids for MoE backends (#30387)
This commit is contained in:
@@ -1307,7 +1307,9 @@ def zero_experts_compute_triton(
|
||||
zero_expert_scales[zero_expert_mask] = 0.0
|
||||
|
||||
normal_expert_mask = expert_indices >= num_experts
|
||||
expert_indices[normal_expert_mask] = -1
|
||||
# Keep a valid routed-expert id for MoE kernels that do not accept negative
|
||||
# ids. The zero scale below still removes the routed-expert contribution.
|
||||
expert_indices[normal_expert_mask] = 0
|
||||
expert_scales[normal_expert_mask] = 0.0
|
||||
|
||||
output = torch.zeros_like(hidden_states).to(hidden_states.device)
|
||||
|
||||
Reference in New Issue
Block a user