Add GGUF support for MiniMax-M2.1 model#44526
Draft
JoursBleu wants to merge 1 commit intohuggingface:mainfrom
Draft
Add GGUF support for MiniMax-M2.1 model#44526JoursBleu wants to merge 1 commit intohuggingface:mainfrom
JoursBleu wants to merge 1 commit intohuggingface:mainfrom
Conversation
42c2be9 to
f73a17f
Compare
f73a17f to
a5f6a94
Compare
a5f6a94 to
13ae746
Compare
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: minimax_m2 |
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?
Add GGUF loading support for MiniMax-M2.1 (456B MoE) model.
MiniMax-M2.1 is a large Mixture-of-Experts model with 456B total parameters (45.9B active), 256 experts and 8 experts per token. This PR enables loading its GGUF-quantized checkpoints (e.g. unsloth/MiniMax-M2.1-GGUF) via
from_pretrained(..., gguf_file=...).Changes
src/transformers/integrations/ggml.py"minimax-m2"entry toGGUF_CONFIG_MAPPINGwith model-specific config fields (including MoE fields:expert_count,expert_used_count,expert_feed_forward_length).GGUFQwen2Converterforminimax_m2inGGUF_TO_FAST_CONVERTERS(tokenizer is compatible with Qwen2).src/transformers/modeling_gguf_pytorch_utils.pyMiniMaxM2TensorProcessorclass following the newTensorProcessorAPI introduced in Qwen2/3 MoE + GGUF model support (restored) #42854:preprocess_name(): strips per-expert indices from HF weight names so that multiple experts can map to one fused GGUF tensor.perform_fallback_tensor_mapping(): manually maps MiniMax-M2'sw1/w2/w3expert naming to GGUF'sffn_gate/down/up_expstensor names, since gguf-py'sname_mapcannot resolve them.process(): matches GGUF MoE expert tensors and splits them per-expert._split_moe_expert_tensor(): slices the fused[num_experts, ...]tensor into individual expert weights.TENSOR_PROCESSORS, add model type and architecture mappings.Testing
Due to the model size (456B parameters, 227GB for Q8_0 GGUF), no CI-compatible unit tests are included. This is consistent with other large MoE models (e.g., Qwen3-30B-A3B in #42854).
Verified end-to-end on 8×AMD W7900D (48GB each) via vLLM serving the Q8_0 GGUF checkpoint:
Before submitting
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.
@SunMarc @MekkCyber @ArthurZucker