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
-
fix m2.1 to m2
d8e43fb -
fix KTransformers tutorial location
b8e098b -
Add KTransformers Support in README.md
Verified signatureAdd KTransformers Support in README.md for MiniMax-M2.1.f7804c9
-
Fix README.md typo (#50)
Verified signature- Fix README.md typo (278a275dc87f60d244d017cea1fcff68e562f45c) Co-authored-by: rogeryoungh <[email protected]>757303d
-
improve model identity in chat template
f62f643
-
Update modeling_minimax_m2.py
Verified signature56992d0 -
Update LICENSE (#39)
Verified signature- Update LICENSE (c307e878715c41a64f42cfd674c468a8467d96a7) Co-authored-by: rogeryoungh <[email protected]>c1be0dc
-
Fix chat_template (#32)
Verified signature- Fix chat_template (41ba56e3cd1188531e34860a18aed92b0cdc42bc) - fix: fix if message.content is none (08db92364daa5f1a8e3939edd6ab2149c7bada46)9354a5c
-
update README
de27025 -
Update docs/transformers_deploy_guide.md
Verified signatureeb390b8 -
Prepare support transformers (#24)
Verified signature- update: prepare for transformers (6d30eb0302d6f70383e70ab9f6dc60466c542eeb) - update: add modeling_minimax_m2.py (35c5c796737083a6db5becdc0d4a4ffbcd1192db) - update: transformers docs (30a4a95ba4b15478b7ad7834cbe99db88330b79e) - update: fix generation_config in docs (8f96eee3cf95d2565e1274f85771639a2e3272b1) - fix: import Unpack from processing_utils (3df78b4d6ccbef8925c7a9c5e345298b72bf1ae8)78ba357
-
update guides
c2b7e11 -
update wechat qrcode
7584a2e -
update guide
3af90e1 -
add wechat on README
d1b3a66 -
upload wechat QRCode
1b75594 -
Improve docs (#23)
Verified signature- Improve docs (361cfd8ed9ffd7f960182e1e67a66e222ff9cc72) Co-authored-by: Prince Canuma <[email protected]>197d677 -
update mlx guide
db1917a -
update mlx-deploy-guide
cad818a -
Add MLX example (#22)
Verified signature- Add MLX example (dc84333379dbe01408ecdf382abaccb53b614c5f) Co-authored-by: Prince Canuma <[email protected]>c706fa1
-
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 <[email protected]>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 <[email protected]>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 <[email protected]>ffec31a
-
Update docs/sglang_deploy_guide.md (#5)
Verified signature- Update docs/sglang_deploy_guide.md (1c8932ef382594711d69a61fa487634facfed1d2) Co-authored-by: zhaochenyang20 <[email protected]>58b625a -
update sglang guide cn
a5ec157 -
update README
9906ce3 -
Update README.md (#4)
Verified signature- Update README.md (5f740fa3cbbcd88f653e47091952ac27e19b94e9) Co-authored-by: zhaochenyang20 <[email protected]>6385c23 -
Update docs/sglang_deploy_guide.md (#3)
Verified signature- Update docs/sglang_deploy_guide.md (17642e051eb70aa9fa0fb77fa827541575640eea) Co-authored-by: zhaochenyang20 <[email protected]>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 <[email protected]>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