Text Generation
Transformers
Safetensors
English
minimax_m2
conversational
custom_code
8-bit precision
quark
Instructions to use amd/MiniMax-M2.7-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amd/MiniMax-M2.7-MXFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amd/MiniMax-M2.7-MXFP4", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("amd/MiniMax-M2.7-MXFP4", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("amd/MiniMax-M2.7-MXFP4", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use amd/MiniMax-M2.7-MXFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amd/MiniMax-M2.7-MXFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/MiniMax-M2.7-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amd/MiniMax-M2.7-MXFP4
- SGLang
How to use amd/MiniMax-M2.7-MXFP4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "amd/MiniMax-M2.7-MXFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/MiniMax-M2.7-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "amd/MiniMax-M2.7-MXFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/MiniMax-M2.7-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amd/MiniMax-M2.7-MXFP4 with Docker Model Runner:
docker model run hf.co/amd/MiniMax-M2.7-MXFP4
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,9 +14,9 @@ license_link: https://huggingface.co/MiniMaxAI/MiniMax-M2.7/blob/main/LICENSE
|
|
| 14 |
- **Input:** Text
|
| 15 |
- **Output:** Text
|
| 16 |
- **Supported Hardware Microarchitecture:** AMD MI300 MI350/MI355
|
| 17 |
-
- **ROCm**:
|
| 18 |
-
- **PyTorch**:
|
| 19 |
-
- **Transformers**:
|
| 20 |
- **Operating System(s):** Linux
|
| 21 |
- **Inference Engine:** [SGLang](https://docs.sglang.ai/)/[vLLM](https://docs.vllm.ai/en/latest/)
|
| 22 |
- **Model Optimizer:** [AMD-Quark](https://quark.docs.amd.com/latest/index.html)
|
|
@@ -26,16 +26,29 @@ license_link: https://huggingface.co/MiniMaxAI/MiniMax-M2.7/blob/main/LICENSE
|
|
| 26 |
|
| 27 |
# Model Quantization
|
| 28 |
|
| 29 |
-
The model was quantized from [
|
| 30 |
|
| 31 |
|
| 32 |
**Quantization scripts:**
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
For further details or issues, please refer to the AMD-Quark documentation or contact the respective developers.
|
| 36 |
|
| 37 |
# Evaluation
|
| 38 |
-
|
| 39 |
|
| 40 |
### Accuracy
|
| 41 |
|
|
@@ -53,11 +66,11 @@ TBD
|
|
| 53 |
<tr>
|
| 54 |
<td>gsm8k (flexible-extract)
|
| 55 |
</td>
|
| 56 |
-
<td>
|
| 57 |
</td>
|
| 58 |
-
<td>
|
| 59 |
</td>
|
| 60 |
-
<td>
|
| 61 |
</td>
|
| 62 |
</tr>
|
| 63 |
</table>
|
|
@@ -65,7 +78,23 @@ TBD
|
|
| 65 |
|
| 66 |
### Reproduction
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
# License
|
| 71 |
Modifications Copyright(c) 2026 Advanced Micro Devices, Inc. All rights reserved.
|
|
|
|
| 14 |
- **Input:** Text
|
| 15 |
- **Output:** Text
|
| 16 |
- **Supported Hardware Microarchitecture:** AMD MI300 MI350/MI355
|
| 17 |
+
- **ROCm**: 7.2.1
|
| 18 |
+
- **PyTorch**: 2.10.0+git8514f05
|
| 19 |
+
- **Transformers**: 4.57.1
|
| 20 |
- **Operating System(s):** Linux
|
| 21 |
- **Inference Engine:** [SGLang](https://docs.sglang.ai/)/[vLLM](https://docs.vllm.ai/en/latest/)
|
| 22 |
- **Model Optimizer:** [AMD-Quark](https://quark.docs.amd.com/latest/index.html)
|
|
|
|
| 26 |
|
| 27 |
# Model Quantization
|
| 28 |
|
| 29 |
+
The model was quantized from [amd/MiniMax-M2.7-BF16](https://huggingface.co/amd/MiniMax-M2.7-BF16) using [AMD-Quark](https://quark.docs.amd.com/latest/index.html). The weights are quantized to MXFP4 and activations are quantized to MXFP4.
|
| 30 |
|
| 31 |
|
| 32 |
**Quantization scripts:**
|
| 33 |
+
```
|
| 34 |
+
export exclude_layers="lm_head *block_sparse_moe.gate* *self_attn*"
|
| 35 |
+
export HIP_VISIBLE_DEVICES=4,5,6,7
|
| 36 |
+
python3 quantize_quark.py --model_dir /shareddata/amd/MiniMax-M2.7-bf16 \
|
| 37 |
+
--quant_scheme mxfp4 \
|
| 38 |
+
--num_calib_data 128 \
|
| 39 |
+
--exclude_layers $exclude_layers \
|
| 40 |
+
--skip_evaluation \
|
| 41 |
+
--multi_gpu \
|
| 42 |
+
--trust_remote_code \
|
| 43 |
+
--model_export hf_format \
|
| 44 |
+
--output_dir /shareddata/amd/MiniMax-M2.7-mxfp4
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
|
| 48 |
For further details or issues, please refer to the AMD-Quark documentation or contact the respective developers.
|
| 49 |
|
| 50 |
# Evaluation
|
| 51 |
+
The model was evaluated on gsm8k benchmarks using the vllm framework.
|
| 52 |
|
| 53 |
### Accuracy
|
| 54 |
|
|
|
|
| 66 |
<tr>
|
| 67 |
<td>gsm8k (flexible-extract)
|
| 68 |
</td>
|
| 69 |
+
<td>91.36
|
| 70 |
</td>
|
| 71 |
+
<td>91.81
|
| 72 |
</td>
|
| 73 |
+
<td>100.49%
|
| 74 |
</td>
|
| 75 |
</tr>
|
| 76 |
</table>
|
|
|
|
| 78 |
|
| 79 |
### Reproduction
|
| 80 |
|
| 81 |
+
The GSM8K results were obtained using the lm-eval framework, based on the Docker image `rocm/vllm-dev:nightly`.
|
| 82 |
+
|
| 83 |
+
#### Launching server
|
| 84 |
+
```
|
| 85 |
+
vllm serve "$MODEL" \
|
| 86 |
+
--tensor-parallel-size 4 \
|
| 87 |
+
--trust-remote-code \
|
| 88 |
+
--max-model-len 32768 \
|
| 89 |
+
--port 8899
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#### Evaluating model in a new terminal
|
| 94 |
+
```
|
| 95 |
+
python vllm/tests/evals/gsm8k/gsm8k_eval.py --host http://127.0.0.1 --port 8899
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
|
| 99 |
# License
|
| 100 |
Modifications Copyright(c) 2026 Advanced Micro Devices, Inc. All rights reserved.
|