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
|
@@ -32,7 +32,6 @@ The model was quantized from [amd/MiniMax-M2.7-BF16](https://huggingface.co/amd/
|
|
| 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 \
|
|
@@ -66,11 +65,11 @@ The model was evaluated on gsm8k benchmarks using the vllm framework.
|
|
| 66 |
<tr>
|
| 67 |
<td>gsm8k (flexible-extract)
|
| 68 |
</td>
|
| 69 |
-
<td>91.36
|
| 70 |
-
</td>
|
| 71 |
<td>91.81
|
| 72 |
</td>
|
| 73 |
-
<td>
|
|
|
|
|
|
|
| 74 |
</td>
|
| 75 |
</tr>
|
| 76 |
</table>
|
|
@@ -84,15 +83,14 @@ The GSM8K results were obtained using the lm-eval framework, based on the Docker
|
|
| 84 |
```
|
| 85 |
vllm serve "$MODEL" \
|
| 86 |
--tensor-parallel-size 4 \
|
| 87 |
-
--
|
| 88 |
-
--
|
| 89 |
-
--port 8899
|
| 90 |
```
|
| 91 |
|
| 92 |
|
| 93 |
#### Evaluating model in a new terminal
|
| 94 |
```
|
| 95 |
-
python vllm/tests/evals/gsm8k/gsm8k_eval.py
|
| 96 |
```
|
| 97 |
|
| 98 |
|
|
|
|
| 32 |
**Quantization scripts:**
|
| 33 |
```
|
| 34 |
export exclude_layers="lm_head *block_sparse_moe.gate* *self_attn*"
|
|
|
|
| 35 |
python3 quantize_quark.py --model_dir /shareddata/amd/MiniMax-M2.7-bf16 \
|
| 36 |
--quant_scheme mxfp4 \
|
| 37 |
--num_calib_data 128 \
|
|
|
|
| 65 |
<tr>
|
| 66 |
<td>gsm8k (flexible-extract)
|
| 67 |
</td>
|
|
|
|
|
|
|
| 68 |
<td>91.81
|
| 69 |
</td>
|
| 70 |
+
<td>91.89
|
| 71 |
+
</td>
|
| 72 |
+
<td>100.09%
|
| 73 |
</td>
|
| 74 |
</tr>
|
| 75 |
</table>
|
|
|
|
| 83 |
```
|
| 84 |
vllm serve "$MODEL" \
|
| 85 |
--tensor-parallel-size 4 \
|
| 86 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 87 |
+
--reasoning-parser minimax_m2_append_think
|
|
|
|
| 88 |
```
|
| 89 |
|
| 90 |
|
| 91 |
#### Evaluating model in a new terminal
|
| 92 |
```
|
| 93 |
+
python vllm/tests/evals/gsm8k/gsm8k_eval.py
|
| 94 |
```
|
| 95 |
|
| 96 |
|