Compare commits

...

2 Commits

Author SHA1 Message Date
A-transformer
dc74e9aac3
Merge 3421621d7b31fe632bdf1f1771f2ccbac705027c into f6e34dd26772dd4a216be94a8899276c5dca9e43 2025-06-19 11:25:07 -04:00
A-transformer
3421621d7b
NoneType check
self.experts has None values for non-local experts.
This will cause NoneType object is not callable.
2025-03-06 19:33:10 +04:00

View File

@ -679,7 +679,7 @@ class MoE(nn.Module):
y = torch.zeros_like(x)
counts = torch.bincount(indices.flatten(), minlength=self.n_routed_experts).tolist()
for i in range(self.experts_start_idx, self.experts_end_idx):
if counts[i] == 0:
if counts[i] == 0 or self.experts[i] is None:
continue
expert = self.experts[i]
idx, top = torch.where(indices == i)