diff --git a/python/sglang/srt/models/mixtral_quant.py b/python/sglang/srt/models/mixtral_quant.py index 5b84c90ddf78..10bfa5068de2 100644 --- a/python/sglang/srt/models/mixtral_quant.py +++ b/python/sglang/srt/models/mixtral_quant.py @@ -115,10 +115,10 @@ def __init__( f"the number of experts {self.num_total_experts}." ) # Split experts equally between ranks - self.expert_indicies = np.array_split( + self.expert_indices = np.array_split( range(self.num_total_experts), self.tp_size )[self.rank].tolist() - if not self.expert_indicies: + if not self.expert_indices: raise ValueError(f"Rank {self.rank} has no experts assigned to it.") self.experts = nn.ModuleList( @@ -131,7 +131,7 @@ def __init__( quant_config=quant_config, prefix=add_prefix(f"experts.{idx}", prefix), ) - if idx in self.expert_indicies + if idx in self.expert_indices else None ) for idx in range(self.num_total_experts) @@ -155,7 +155,7 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: routing_weights /= routing_weights.sum(dim=-1, keepdim=True) final_hidden_states = None - for expert_idx in self.expert_indicies: + for expert_idx in self.expert_indices: expert_layer = self.experts[expert_idx] expert_mask = selected_experts == expert_idx expert_weights = (routing_weights * expert_mask).sum(dim=-1, keepdim=True)