Fix transformers MoE compatibility with VLLM - #42429
Conversation
|
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.
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.
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 🎉 ! |
|
[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 |
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/