Qwen2/3 MoE + GGUF model support (restored)#42854
Merged
SunMarc merged 1 commit intohuggingface:mainfrom Dec 17, 2025
Merged
Conversation
This commit restores Qwen2/3 MoE + GGUF support in Transformers v5. In this version, handling of MoE tensors are significantly changed so that support for all MoE + GGUF models ... (okay, only) Qwen2/3 MoE models in Transformers v4 is now broken. This commit now adopts new tensor handling, along with extended `TensorProcessor` with capabilities to handle not only tensor data but also tensor mappings. In this process, Qwen2/3 MoE-specific hack is moved to `Qwen2MoeTensorProcessor`, making the main function to look more model-agnostic. This is fully tested on Qwen2 MoE `Qwen1.5-MoE-A2.7B` and partially on Qwen3 MoE `Qwen3-30B-A3B-Thinking-2507` (due to memory constraints). Signed-off-by: Tsukasa OI <floss_llm@irq.a4lg.com>
688c1bf to
d82151b
Compare
SunMarc
approved these changes
Dec 17, 2025
|
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. |
SangbumChoi
pushed a commit
to SangbumChoi/transformers
that referenced
this pull request
Jan 23, 2026
This commit restores Qwen2/3 MoE + GGUF support in Transformers v5. In this version, handling of MoE tensors are significantly changed so that support for all MoE + GGUF models ... (okay, only) Qwen2/3 MoE models in Transformers v4 is now broken. This commit now adopts new tensor handling, along with extended `TensorProcessor` with capabilities to handle not only tensor data but also tensor mappings. In this process, Qwen2/3 MoE-specific hack is moved to `Qwen2MoeTensorProcessor`, making the main function to look more model-agnostic. This is fully tested on Qwen2 MoE `Qwen1.5-MoE-A2.7B` and partially on Qwen3 MoE `Qwen3-30B-A3B-Thinking-2507` (due to memory constraints). Signed-off-by: Tsukasa OI <floss_llm@irq.a4lg.com>
JoursBleu
added a commit
to JoursBleu/transformers
that referenced
this pull request
Mar 8, 2026
- Add minimax-m2 GGUF config mapping (MoE fields: expert_count, expert_used_count) - Add MiniMaxM2TensorProcessor with preprocess_name() and perform_fallback_tensor_mapping() for w1/w2/w3 -> gate/down/up expert tensor splitting (follows new TensorProcessor API from huggingface#42854) - Add GGUFQwen2Converter for minimax_m2 tokenizer - Add model_type (minimax_m2 <-> minimax-m2) and architecture mappings - Add MiniMax-M2 to supported models in gguf.md
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This commit restores Qwen2/3 MoE + GGUF support in Transformers v5.
In this version, handling of MoE tensors are significantly changed so that support for all MoE + GGUF models ... (okay, actually) Qwen2/3 MoE models in Transformers v4 is now broken in v5.
This commit now adopts new tensor handling, along with extended
TensorProcessorwith capabilities to handle not only tensor data but also tensor mappings.In this process, Qwen2/3 MoE-specific hack is moved to
Qwen2MoeTensorProcessor, making the main function to look more model-agnostic.This is fully tested on Qwen2 MoE
Qwen1.5-MoE-A2.7B(with 14.3B total parameters) and partially on Qwen3 MoEQwen3-30B-A3B-Thinking-2507(due to memory constraints).Future Possibilities
Portions of this change is written to be model-agnostic and easily replaceable.
If we decide to add more GGUF support to MoE models, we'd better to have either a mix-in or an utility. In this case, a part of
Qwen2MoeTensorProcessorcan be copied to that with small modification.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@Cyrilvallez @SunMarc @MekkCyber