This commit is contained in:
A-transformer 2025-04-09 10:32:47 -04:00 committed by GitHub
commit 1471809b9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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)