-
Notifications
You must be signed in to change notification settings - Fork 31.3k
Fix transformers MoE compatibility with VLLM #42429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[For maintainers] Suggested jobs to run (before merge) run-slow: flex_olmo, gpt_oss, minimax, mixtral, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe, qwen3_vl_moe |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
ArthurZucker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! We can prob ably just put router_scores = torch.zeros_like(router_logits).scatter_(1, router_indices, router_top_value) for ep?
EP testing needs to be done with GPT OSS rather than any other model, or you can use mixtral ....
TLDR As long as it has:
base_model_tp_plan = {
"layers.*.self_attn.q_proj": "colwise",
"layers.*.self_attn.k_proj": "colwise",
"layers.*.self_attn.v_proj": "colwise",
"layers.*.self_attn.o_proj": "rowwise",
"layers.*.mlp.gate": "ep_router", # we need to replicate here to correctly route experts
"layers.*.mlp.experts.gate_up_proj": "local_colwise",
"layers.*.mlp.experts.down_proj": "local_rowwise",
"layers.*.mlp.experts": "gather",
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove when we merge!
|
run-slow: flex_olmo, gpt_oss, minimax, mixtral, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe, qwen3_vl_moe |
|
This comment contains models: ["models/flex_olmo", "models/gpt_oss", "models/minimax", "models/mixtral", "models/olmoe", "models/qwen2_moe", "models/qwen3_moe", "models/qwen3_next", "models/qwen3_omni_moe", "models/qwen3_vl_moe"] |
CI Results✅ No failing test specific to this PR 🎉 ! |
torch.zeros_like(router_logits).scatter_(1, router_indices, router_top_value)is needed (argument was it is needed during EP but if EP is enabled, the whole function is ignore anyway)NOTE: EP was broken already so need to check following PR #42183
Take away:
zeros_like + scatterso find another solution and fix breaking tests (cf https://github.com/huggingface/transformers/actions/runs/19738722845/job/56557321765) => Follow up PR Fix MoE for V5 #42456Test results
Testing methodology
mkdir tests_results && ./test_moe_inference.sh tests_results/