From 3421621d7b31fe632bdf1f1771f2ccbac705027c Mon Sep 17 00:00:00 2001 From: A-transformer Date: Thu, 6 Mar 2025 19:33:10 +0400 Subject: [PATCH] NoneType check self.experts has None values for non-local experts. This will cause NoneType object is not callable. --- inference/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inference/model.py b/inference/model.py index 8f1ab81..4a37db8 100644 --- a/inference/model.py +++ b/inference/model.py @@ -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)