Skip to content

Commit 5fb45a6

Browse files
authored
Merge pull request #200 from Heihaierr/master
Update switch_gate.py
2 parents b477ab5 + 22f6e46 commit 5fb45a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fmoe/gates/switch_gate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def forward(self, inp):
4242
top1_score = top1_score.to(dtype=inp.dtype)
4343

4444
cap_rate = self.capacity[0 if self.training else 1]
45-
capacity = math.ceil(cap_rate * inp.shape[0])
45+
capacity = math.ceil(cap_rate * inp.shape[0] / self.num_expert)
4646
_new_lec, _new_gec, top1_idx = limit_by_capacity(
4747
top1_idx, self.num_expert, self.world_size, capacity)
4848

0 commit comments

Comments
 (0)