Instructions to use MiniMaxAI/MiniMax-M2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-M2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MiniMaxAI/MiniMax-M2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MiniMaxAI/MiniMax-M2", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("MiniMaxAI/MiniMax-M2", trust_remote_code=True, device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MiniMaxAI/MiniMax-M2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-M2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MiniMaxAI/MiniMax-M2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MiniMaxAI/MiniMax-M2
- SGLang
How to use MiniMaxAI/MiniMax-M2 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 "MiniMaxAI/MiniMax-M2" \ --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": "MiniMaxAI/MiniMax-M2", "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 "MiniMaxAI/MiniMax-M2" \ --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": "MiniMaxAI/MiniMax-M2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MiniMaxAI/MiniMax-M2 with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-M2
Commit History
-
Add MLX example
Verified signaturedc84333 -
add community showcases
457945b
-
fix config typo
44cefa6 -
update README
3f46446 -
Adding `transformers` as the library name (#10)
Verified signature- Adding `transformers` as the library name (8ddefd77453535cfc4cafc1ccced3ee574b2d39b) Co-authored-by: Aritra Roy Gosthipaty <ariG23498@users.noreply.huggingface.co>2c35de5 -
Update README.md
Verified signature14ec561 -
update bench figure
59f758d -
update README
1fe6a45 -
update guides
a970723 -
update sglang guide
4167c37 -
Update generation_config.json
Verified signaturee977417 -
update top_k
48a6a46 -
update README
00b05bd -
Update README.md (#6)
Verified signature- Update README.md (d1a4154f786ecba9bb2482e9abc57a3296f94a0b) Co-authored-by: zhaochenyang20 <zhaochenyang20@users.noreply.huggingface.co>c858585 -
Fix SGLang version in CN deployment guide (#7)
Verified signature- Fix SGLang version in CN deployment guide (d4908cd2a29322b899ac1755a05f0cfd8fc7d0ec) - Update docs/sglang_deploy_guide.md (9633636593e519118bc35d9942b4549cc1da1082) Co-authored-by: Kangyan Zhou <kzhou10@users.noreply.huggingface.co>ffec31a
-
Update docs/sglang_deploy_guide.md (#5)
Verified signature- Update docs/sglang_deploy_guide.md (1c8932ef382594711d69a61fa487634facfed1d2) Co-authored-by: zhaochenyang20 <zhaochenyang20@users.noreply.huggingface.co>58b625a -
update sglang guide cn
a5ec157 -
update README
9906ce3 -
Update README.md (#4)
Verified signature- Update README.md (5f740fa3cbbcd88f653e47091952ac27e19b94e9) Co-authored-by: zhaochenyang20 <zhaochenyang20@users.noreply.huggingface.co>6385c23 -
Update docs/sglang_deploy_guide.md (#3)
Verified signature- Update docs/sglang_deploy_guide.md (17642e051eb70aa9fa0fb77fa827541575640eea) Co-authored-by: zhaochenyang20 <zhaochenyang20@users.noreply.huggingface.co>e6d447f -
update README
jiaxinc4075e3 -
update README
jiaxin8abcad7 -
update README
jiaxinb86f414 -
update README
jiaxinb3891ac -
update README
jiaxin698aec0 -
update REDME and guides
jiaxin7496e98 -
add vllm inference recipes (#1)
Verified signature- add vllm inference recipes (d281b25e55cbbba8d626bbc9c1c185e6aaa8db29) Co-authored-by: Kaichao <youkaichao@users.noreply.huggingface.co>05f3755 -
Create generation_config.json
Verified signaturecab79a3
-
Upload folder using huggingface_hub
Verified signature58e991b -
Upload folder using huggingface_hub
Verified signature08ffcac -
Upload folder using huggingface_hub
Verified signature7a420b6 -
Delete docs/function_call_guide_en.md
Verified signaturea917c26 -
Upload folder using huggingface_hub
Verified signature79891b6 -
Upload folder using huggingface_hub
Verified signature33605fc -
Update config.json
Verified signatureda5eb8f
-
update README
Verified signatured266872 -
Update README.md
Verified signature580f438 -
Upload folder using huggingface_hub
Verified signature7712f85 -
Add files using upload-large-folder tool
Verified signature0c2f98c -
Add files using upload-large-folder tool
Verified signaturedb6dc62 -
Add files using upload-large-folder tool
Verified signature4930327
-
initial commit
Verified signature67617f9