Fix MoE for V5
Author: 3outeille
Pull request: yes


Comments:
run-slow: flex_olmo, gpt_oss, minimax, mixtral, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe, qwen3_vl_moe

run-slow: flex_olmo, gpt_oss, minimax, mixtral, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe, qwen3_vl_moe

This comment contains `run-slow`, running the specified jobs: 

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"]
quantizations: []

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_42456). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

run-slow: flex_olmo, gpt_oss, minimax, mixtral, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe, qwen3_vl_moe

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/19740956241)

⚠️ No test being reported (jobs are skipped or cancelled)!


💔 This comment contains `run-slow`, but unknown error occurred and [the workflow run](https://github.com/huggingface/transformers/actions/runs/19744740875) aborted!

run-slow: flex_olmo, gpt_oss, minimax, mixtral, olmoe, qwen2_moe, qwen3_moe, qwen3_next, qwen3_omni_moe, qwen3_vl_moe

This comment contains `run-slow`, running the specified jobs: 

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"]
quantizations: []

run-slow: deepseek_v2, deepseek_v3, dots1, flex_olmo, glm4_moe, glm4v_moe, gpt_oss, hunyuan_v1_moe, jamba, lfm2_moe, minimax, mixtral, olmoe, phimoe, qwen2_moe, qwen3_moe

run-slow: deepseek_v2, deepseek_v3, dots1, flex_olmo, glm4_moe, glm4v_moe, gpt_oss, hunyuan_v1_moe, jamba, lfm2_moe, minimax, mixtral, olmoe, phimoe, qwen2_moe, qwen3_moe

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/19758565181)

⚠️ No test being reported (jobs are skipped or cancelled)!


💔 This comment contains `run-slow`, but unknown error occurred and [the workflow run](https://github.com/huggingface/transformers/actions/runs/19759944431) aborted!

run-slow: deepseek_v2, deepseek_v3, dots1, flex_olmo, glm4_moe, glm4v_moe, gpt_oss, hunyuan_v1_moe, jamba, lfm2_moe, minimax, mixtral, olmoe, phimoe, qwen2_moe, qwen3_moe

This comment contains `run-slow`, running the specified jobs: 

models: ["models/deepseek_v2", "models/deepseek_v3", "models/dots1", "models/flex_olmo", "models/glm4_moe", "models/glm4v_moe", "models/gpt_oss", "models/hunyuan_v1_moe", "models/jamba", "models/lfm2_moe", "models/minimax", "models/mixtral", "models/olmoe", "models/phimoe", "models/qwen2_moe", "models/qwen3_moe"]
quantizations: []

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/19768026992)

### Model CI Report

#### ❌ Failed tests

- [gpt_oss](https://github.com/huggingface/transformers/actions/runs/19768026992/job/56645846627):
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_assisted_decoding_matches_greedy_search_0_random
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_assisted_decoding_matches_greedy_search_1_same
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_assisted_decoding_sample
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_attention_outputs
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_batching_equivalence
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_beam_sample_generate
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_beam_sample_generate_dict_output
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_beam_search_generate
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_beam_search_generate_dict_output
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_beam_search_generate_dict_outputs_use_cache
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_causal_lm_can_accept_training_kwargs
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_cpu_offload
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_determinism
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_disk_offload_bin
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_disk_offload_safetensors
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_feed_forward_chunking
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_forward_with_logits_to_keep
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_compilation_all_outputs
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_compile_model_forward_fullgraph
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_continue_from_inputs_embeds
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_continue_from_past_key_values
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_from_inputs_embeds_0_greedy
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_from_inputs_embeds_1_beam_search
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_from_inputs_embeds_with_static_cache
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_from_random_inputs_embeds
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_methods_with_logits_to_keep
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_generate_with_static_cache
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_greedy_generate
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_greedy_generate_dict_outputs
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_greedy_generate_dict_outputs_use_cache
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_hidden_states_output
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_inputs_embeds
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_inputs_embeds_matches_input_ids
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_left_padding_compatibility
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_load_with_mismatched_shapes
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_model
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_model_outputs_equivalence
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_model_rope_scaling_from_config_0_linear
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_model_rope_scaling_from_config_1_dynamic
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_model_rope_scaling_from_config_2_yarn
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_past_key_values_format
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_prompt_lookup_decoding_matches_greedy_search
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_resize_embeddings_untied
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_sample_generate
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_sample_generate_dict_output
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_save_load
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_sequence_classification_model
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_sequence_classification_model_for_multi_label
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_sequence_classification_model_for_single_label
    tests/models/gpt_oss/test_modeling_gpt_oss.py::GptOssModelTest::test_token_classification_model



run-slow: deepseek_v2, deepseek_v3, dots1, flex_olmo, glm4_moe, glm4v_moe, gpt_oss, hunyuan_v1_moe, jamba, lfm2_moe, minimax, mixtral, nanochat, olmoe, phimoe, qwen2_moe

This comment contains `run-slow`, running the specified jobs: 

models: ["models/deepseek_v2", "models/deepseek_v3", "models/dots1", "models/flex_olmo", "models/glm4_moe", "models/glm4v_moe", "models/gpt_oss", "models/hunyuan_v1_moe", "models/jamba", "models/lfm2_moe", "models/minimax", "models/mixtral", "models/nanochat", "models/olmoe", "models/phimoe", "models/qwen2_moe"]
quantizations: []

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/19775405529)

✅ No failing test specific to this PR 🎉 !


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

run-slow: deepseek_v2, deepseek_v3, dots1, flex_olmo, glm4_moe, glm4v_moe, gpt_oss, hunyuan_v1_moe, jamba, lfm2_moe, minimax, mixtral, olmoe, phimoe, qwen2_moe, qwen3_moe