Instructions to use MiniMaxAI/MiniMax-M2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-M2.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MiniMaxAI/MiniMax-M2.1", 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.1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("MiniMaxAI/MiniMax-M2.1", 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
- vLLM
How to use MiniMaxAI/MiniMax-M2.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-M2.1" # 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.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MiniMaxAI/MiniMax-M2.1
- SGLang
How to use MiniMaxAI/MiniMax-M2.1 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.1" \ --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.1", "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.1" \ --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.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MiniMaxAI/MiniMax-M2.1 with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-M2.1
xuebi commited on
Commit ·
7d718af
1
Parent(s): 927ea2b
update: clearify supported context length in docs
Browse files
docs/sglang_deploy_guide.md
CHANGED
|
@@ -27,9 +27,9 @@ The deployment process is illustrated below using MiniMax-M2.1 as an example.
|
|
| 27 |
|
| 28 |
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 29 |
|
| 30 |
-
- 4x 96GB GPUs:
|
| 31 |
|
| 32 |
-
- 8x 144GB GPUs:
|
| 33 |
|
| 34 |
## Deployment with Python
|
| 35 |
|
|
|
|
| 27 |
|
| 28 |
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 29 |
|
| 30 |
+
- 4x 96GB GPUs: Supports 400K aggregate KV cache tokens. (Max 196K per sequence)
|
| 31 |
|
| 32 |
+
- 8x 144GB GPUs: Supports 3M aggregate KV cache tokens. (Max 196K per sequence)
|
| 33 |
|
| 34 |
## Deployment with Python
|
| 35 |
|
docs/sglang_deploy_guide_cn.md
CHANGED
|
@@ -27,9 +27,9 @@
|
|
| 27 |
|
| 28 |
以下为推荐配置,实际需求请根据业务场景调整:
|
| 29 |
|
| 30 |
-
- 96G x4 GPU:支持 40 万 token 的总上下文。
|
| 31 |
|
| 32 |
-
- 144G x8 GPU:支持长达 300 万 token 的总上下文。
|
| 33 |
|
| 34 |
## 使用 Python 部署
|
| 35 |
|
|
|
|
| 27 |
|
| 28 |
以下为推荐配置,实际需求请根据业务场景调整:
|
| 29 |
|
| 30 |
+
- 96G x4 GPU:支持 40 万 token 的总上下文(每个序列最多 19.6 万个)。
|
| 31 |
|
| 32 |
+
- 144G x8 GPU:支持长达 300 万 token 的总上下文(每个序列最多 19.6 万个)。
|
| 33 |
|
| 34 |
## 使用 Python 部署
|
| 35 |
|
docs/vllm_deploy_guide.md
CHANGED
|
@@ -26,9 +26,9 @@ The deployment process is illustrated below using MiniMax-M2.1 as an example.
|
|
| 26 |
|
| 27 |
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 28 |
|
| 29 |
-
- 4x 96GB GPUs:
|
| 30 |
|
| 31 |
-
- 8x 144GB GPUs:
|
| 32 |
|
| 33 |
## Deployment with Python
|
| 34 |
|
|
|
|
| 26 |
|
| 27 |
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 28 |
|
| 29 |
+
- 4x 96GB GPUs: Supports 400K aggregate KV cache tokens. (Max 196K per sequence)
|
| 30 |
|
| 31 |
+
- 8x 144GB GPUs: Supports 3M aggregate KV cache tokens. (Max 196K per sequence)
|
| 32 |
|
| 33 |
## Deployment with Python
|
| 34 |
|
docs/vllm_deploy_guide_cn.md
CHANGED
|
@@ -26,9 +26,9 @@
|
|
| 26 |
|
| 27 |
以下为推荐配置,实际需求请根据业务场景调整:
|
| 28 |
|
| 29 |
-
- 96G x4 GPU:支持 40 万 token 的总上下文。
|
| 30 |
|
| 31 |
-
- 144G x8 GPU:支持长达 300 万 token 的总上下文。
|
| 32 |
|
| 33 |
## 使用 Python 部署
|
| 34 |
|
|
|
|
| 26 |
|
| 27 |
以下为推荐配置,实际需求请根据业务场景调整:
|
| 28 |
|
| 29 |
+
- 96G x4 GPU:支持 40 万 token 的总上下文(每个序列最多 19.6 万个)。
|
| 30 |
|
| 31 |
+
- 144G x8 GPU:支持长达 300 万 token 的总上下文(每个序列最多 19.6 万个)。
|
| 32 |
|
| 33 |
## 使用 Python 部署
|
| 34 |
|