Text Generation
Transformers
Safetensors
English
minimax_m2
conversational
custom_code
8-bit precision
quark
Instructions to use amd/MiniMax-M2.5-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amd/MiniMax-M2.5-MXFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amd/MiniMax-M2.5-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.5-MXFP4", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("amd/MiniMax-M2.5-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.5-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.5-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.5-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amd/MiniMax-M2.5-MXFP4
- SGLang
How to use amd/MiniMax-M2.5-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.5-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.5-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.5-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.5-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amd/MiniMax-M2.5-MXFP4 with Docker Model Runner:
docker model run hf.co/amd/MiniMax-M2.5-MXFP4
Update README.md
Browse files
README.md
CHANGED
|
@@ -77,35 +77,26 @@ The model was evaluated on gsm8k benchmarks using the [vllm](https://github.com/
|
|
| 77 |
|
| 78 |
### Reproduction
|
| 79 |
|
| 80 |
-
The GSM8K results were obtained using the
|
| 81 |
|
| 82 |
-
####
|
| 83 |
-
```
|
| 84 |
-
# Reinstall vLLM
|
| 85 |
-
pip uninstall vllm -y
|
| 86 |
-
git clone https://github.com/vllm-project/vllm.git
|
| 87 |
-
cd vllm
|
| 88 |
-
git checkout v0.13.0
|
| 89 |
-
pip install -r requirements/rocm.txt
|
| 90 |
-
python setup.py develop
|
| 91 |
-
cd ..
|
| 92 |
```
|
|
|
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
VLLM_ROCM_USE_AITER=1 \
|
| 97 |
-
VLLM_DISABLE_COMPILE_CACHE=1 \
|
| 98 |
-
vllm serve "$MODEL" \
|
| 99 |
-
--tensor-parallel-size 4 \
|
| 100 |
-
--trust-remote-code \
|
| 101 |
-
--max-model-len 32768 \
|
| 102 |
-
--port 8899
|
| 103 |
-
```
|
| 104 |
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
```
|
| 110 |
|
| 111 |
|
|
|
|
| 77 |
|
| 78 |
### Reproduction
|
| 79 |
|
| 80 |
+
The GSM8K results were obtained using the lm-eval framework, based on the Docker image `rocm/vllm-dev:nightly`.
|
| 81 |
|
| 82 |
+
#### Evaluating model in a new terminal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
```
|
| 84 |
+
export VLLM_ROCM_USE_AITER=1
|
| 85 |
|
| 86 |
+
export model_dir_fp4=MiniMaxAI/MiniMax-M2.5-mxfp4/
|
| 87 |
+
log_file=minimax25-lm_eval_gsm8k_mxfp4.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
lm_eval --model vllm --model_args pretrained=$model_dir_fp4,enforce_eager=True,trust_remote_code=True,max_model_len=16384 \
|
| 90 |
+
--gen_kwargs temperature=1.0,top_p=0.95,top_k=40 \
|
| 91 |
+
--tasks gsm8k --num_fewshot 8 2>&1 | tee $log_file
|
| 92 |
|
| 93 |
+
|
| 94 |
+
export model_dir=MiniMaxAI/MiniMax-M2.5/
|
| 95 |
+
log_file=minimax25-lm_eval_gsm8k.txt
|
| 96 |
+
|
| 97 |
+
lm_eval --model vllm --model_args pretrained=$model_dir,enforce_eager=True,tensor_parallel_size=8,trust_remote_code=True,max_model_len=16384 \
|
| 98 |
+
--gen_kwargs temperature=0.8,top_p=0.95,top_k=40 \
|
| 99 |
+
--tasks gsm8k --num_fewshot 8 2>&1 | tee $log_file
|
| 100 |
```
|
| 101 |
|
| 102 |
|