We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b477ab5 + 22f6e46 commit 5fb45a6Copy full SHA for 5fb45a6
fmoe/gates/switch_gate.py
@@ -42,7 +42,7 @@ def forward(self, inp):
42
top1_score = top1_score.to(dtype=inp.dtype)
43
44
cap_rate = self.capacity[0 if self.training else 1]
45
- capacity = math.ceil(cap_rate * inp.shape[0])
+ capacity = math.ceil(cap_rate * inp.shape[0] / self.num_expert)
46
_new_lec, _new_gec, top1_idx = limit_by_capacity(
47
top1_idx, self.num_expert, self.world_size, capacity)
48
0 commit comments