Skip to content

Conversation

@danielquintas8
Copy link
Contributor

What does this PR do?

This PR includes two small improvements for route_tokens_to_experts in MoE models:

  • Improves Readability: Renames the function's input argument from hidden_states to router_logits. This more accurately reflects that the function receives the output of the gating network.
  • Improves Robustness: Changes the softmax dimension from dim=1 to dim=-1. While functionally identical in the current implementation, dim=-1 is more explicit and ensures the logic remains correct if the tensor shape ever changes.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@ArthurZucker
@Cyrilvallez

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: dbrx, ernie4_5_moe, flex_olmo, hunyuan_v1_moe, jamba, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant