[fix typo] expert_indicies -> expert_indices (#19627)
Co-authored-by: ishandhanani <82981111+ishandhanani@users.noreply.github.com>
This commit is contained in:
co-authored by
ishandhanani
parent
f51ddba131
commit
20282f5664
@@ -115,10 +115,10 @@ class MixtralMoE(nn.Module):
|
|||||||
f"the number of experts {self.num_total_experts}."
|
f"the number of experts {self.num_total_experts}."
|
||||||
)
|
)
|
||||||
# Split experts equally between ranks
|
# 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
|
range(self.num_total_experts), self.tp_size
|
||||||
)[self.rank].tolist()
|
)[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.")
|
raise ValueError(f"Rank {self.rank} has no experts assigned to it.")
|
||||||
|
|
||||||
self.experts = nn.ModuleList(
|
self.experts = nn.ModuleList(
|
||||||
@@ -131,7 +131,7 @@ class MixtralMoE(nn.Module):
|
|||||||
quant_config=quant_config,
|
quant_config=quant_config,
|
||||||
prefix=add_prefix(f"experts.{idx}", prefix),
|
prefix=add_prefix(f"experts.{idx}", prefix),
|
||||||
)
|
)
|
||||||
if idx in self.expert_indicies
|
if idx in self.expert_indices
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
for idx in range(self.num_total_experts)
|
for idx in range(self.num_total_experts)
|
||||||
@@ -155,7 +155,7 @@ class MixtralMoE(nn.Module):
|
|||||||
routing_weights /= routing_weights.sum(dim=-1, keepdim=True)
|
routing_weights /= routing_weights.sum(dim=-1, keepdim=True)
|
||||||
|
|
||||||
final_hidden_states = None
|
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_layer = self.experts[expert_idx]
|
||||||
expert_mask = selected_experts == expert_idx
|
expert_mask = selected_experts == expert_idx
|
||||||
expert_weights = (routing_weights * expert_mask).sum(dim=-1, keepdim=True)
|
expert_weights = (routing_weights * expert_mask).sum(dim=-1, keepdim=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user