Update modeling_super_linear.py
Browse files361 unmodified lines3623633643653653663683673683693703712 unmodified lines37437537637737737837939 unmodified lines419420421422423424425361 unmodified lines
# Get expert probabilities and convert to numpy probs_np = expert_probs.detach().cpu().numpy()
# Create a nicer figure with a modern style plt.style.use('ggplot') fig, ax = plt.figure(figsize=(12, 8), dpi=120) plt.figure(figsize=(12, 8), dpi=120) plt.subplot(111) ax = plt.subplot(111)
# Create color gradient based on probability values2 unmodified lines # Plot bars with more attractive styling bars = plt.bar(range(len(probs_np)), probs_np, color=colors, width=0.6, edgecolor='black', linewidth=0.5, alpha=0.85)
# Add value annotations on top of each bar for i, bar in enumerate(bars): height = bar.get_height()39 unmodified lines plt.close() print(expert_probs.shape) if get_prob: expert_probs = F.softmax(self.gate_outputs, dim=1) print(expert_probs.shape)modeling_super_linear.py+3-3