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)# 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) 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]:])) - Inference
- HuggingChat
- 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
update README
Browse files
README.md
CHANGED
|
@@ -26,35 +26,42 @@ library_name: transformers
|
|
| 26 |
</div>
|
| 27 |
<hr>
|
| 28 |
|
| 29 |
-
<div align="center" style="line-height: 1;">
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
<a
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
<
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
</div>
|
| 43 |
-
<div align="center" style="
|
| 44 |
<a href="https://huggingface.co/MiniMaxAI" target="_blank" style="margin: 2px;">
|
| 45 |
-
|
| 46 |
-
</a>
|
| 47 |
<a href="https://github.com/MiniMax-AI/MiniMax-M2" target="_blank" style="margin: 2px;">
|
| 48 |
-
|
| 49 |
-
</a>
|
| 50 |
<a href="https://www.modelscope.cn/organization/MiniMax" target="_blank" style="margin: 2px;">
|
| 51 |
-
|
| 52 |
-
</a>
|
| 53 |
<a href="https://github.com/MiniMax-AI/MiniMax-M2/blob/main/LICENSE" style="margin: 2px;">
|
| 54 |
-
|
| 55 |
-
</a>
|
| 56 |
-
<a href="https://github.com/MiniMax-AI/MiniMax-AI.github.io/blob/main/images/wechat-qrcode.jpeg" target="_blank" style="margin: 2px;">
|
| 57 |
-
<img alt="WeChat" src="https://img.shields.io/badge/💬_WeChat-MiniMax-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 58 |
</a>
|
| 59 |
</div>
|
| 60 |
|
|
|
|
| 26 |
</div>
|
| 27 |
<hr>
|
| 28 |
|
| 29 |
+
<div align="center" style="line-height: 1.4; font-size:16px; margin-top: 30px;">
|
| 30 |
+
Join Our
|
| 31 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-AI.github.io/blob/main/images/wechat-qrcode.jpeg" target="_blank" style="font-size:17px; margin: 2px;">
|
| 32 |
+
💬 WeChat
|
| 33 |
+
</a> |
|
| 34 |
+
<a href="https://discord.com/invite/hvvt8hAye6" target="_blank" style="font-size:17px; margin: 2px;">
|
| 35 |
+
🧩 Discord
|
| 36 |
+
</a>
|
| 37 |
+
community.
|
| 38 |
+
</div>
|
| 39 |
+
<div align="center" style="line-height: 1.2; font-size:16px;">
|
| 40 |
+
<a href="https://agent.minimax.io/" target="_blank" style="display: inline-block; margin: 4px;">
|
| 41 |
+
MiniMax Agent
|
| 42 |
+
</a> |
|
| 43 |
+
<a href="https://platform.minimax.io/docs/guides/text-generation" target="_blank" style="display: inline-block; margin: 4px;">
|
| 44 |
+
⚡️ API (Now Free for a limited time!)
|
| 45 |
+
</a> |
|
| 46 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-MCP" style="display: inline-block; margin: 4px;">
|
| 47 |
+
MCP
|
| 48 |
+
</a> |
|
| 49 |
+
<a href="https://www.minimax.io" target="_blank" style="display: inline-block; margin: 4px;">
|
| 50 |
+
MiniMax Website
|
| 51 |
+
</a>
|
| 52 |
</div>
|
| 53 |
+
<div align="center" style="lline-height: 1.2; font-size:16px; margin-bottom: 30px;">
|
| 54 |
<a href="https://huggingface.co/MiniMaxAI" target="_blank" style="margin: 2px;">
|
| 55 |
+
🤗 Hugging Face
|
| 56 |
+
</a> |
|
| 57 |
<a href="https://github.com/MiniMax-AI/MiniMax-M2" target="_blank" style="margin: 2px;">
|
| 58 |
+
🐙 GitHub
|
| 59 |
+
</a> |
|
| 60 |
<a href="https://www.modelscope.cn/organization/MiniMax" target="_blank" style="margin: 2px;">
|
| 61 |
+
🤖️ ModelScope
|
| 62 |
+
</a> |
|
| 63 |
<a href="https://github.com/MiniMax-AI/MiniMax-M2/blob/main/LICENSE" style="margin: 2px;">
|
| 64 |
+
📄 License: MIT
|
|
|
|
|
|
|
|
|
|
| 65 |
</a>
|
| 66 |
</div>
|
| 67 |
|