Update modeling_super_linear.py
Browse files355 unmodified lines3563573583593603611 unmodified line363364365366367368369355 unmodified linesload_balancing_loss = self.calculate_load_balancing_loss(self.gate_outputs, batch_size)expert_probs = F.softmax(self.gate_outputs, dim=1)import matplotlib.pyplot as pltplt.figure(figsize=(10, 6))1 unmodified lineplt.xlabel('Expert Index')plt.ylabel('Probability')plt.title('Expert Selection Probabilities')plt.xticks(range(len(expert_probs)), [f'Expert {i}' for i in range(len(expert_probs))])plt.tight_layout()plt.savefig('expert_probabilities.png')plt.close()355 unmodified lines3563573583593603613623631 unmodified line365366367368369370371372373374375376377378379380355 unmodified linesload_balancing_loss = self.calculate_load_balancing_loss(self.gate_outputs, batch_size)expert_probs = F.softmax(self.gate_outputs, dim=1)expert_probs = expert_probs[1,:]# Plot the expert probabilitiesimport matplotlib.pyplot as pltplt.figure(figsize=(10, 6))1 unmodified lineplt.xlabel('Expert Index')plt.ylabel('Probability')plt.title('Expert Selection Probabilities')# Create more descriptive x-axis labelsif hasattr(self, 'experts') and isinstance(getattr(self, 'experts', None), dict):# If experts are stored in a dictionary with meaningful keysexpert_names = list(self.experts.keys())plt.xticks(range(len(expert_probs)), expert_names, rotation=45)else:# Default numbering if expert names aren't availableplt.xticks(range(len(expert_probs)), [f'Expert {i}' for i in range(len(expert_probs))])plt.tight_layout()plt.savefig('expert_probabilities.png')plt.close()
modeling_super_linear.py+12-1