Skip to content

Commit

Permalink
Update moe.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vchiley authored Jul 19, 2023
1 parent e9738de commit 331b431
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion megablocks/layers/moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def load_balancing_loss(self, tokens_per_expert, expert_scores):
assert num_experts == self.num_experts
scale = self.num_experts / (tokens * self.args.moe_top_k)
return scale * torch.dot(
tokens_per_expert.half(),
tokens_per_expert.to(expert_scores.dtype),
expert_scores.mean(dim=0))

def indices_and_bins(self, top_expert):
Expand Down

0 comments on commit 331b431

Please sign in to comment.