mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-12-16 02:08:55 +08:00
faster generation
This commit is contained in:
@@ -124,7 +124,6 @@ class OlmoeSparseMoeBlock(nn.Module):
|
||||
final_hidden_states = mx.zeros_like(x)
|
||||
for expert_idx in range(self.num_experts):
|
||||
expert_weights = routing_weights[:, expert_idx:expert_idx+1]
|
||||
if mx.max(expert_weights) > 1e-5:
|
||||
expert_output = self.experts[expert_idx](x)
|
||||
final_hidden_states += expert_output * expert_weights
|
||||
return final_hidden_states.reshape(B, L, D)
|
||||
|
||||
Reference in New Issue
Block a user