xuebi
commited on
Commit
·
4d0619f
1
Parent(s):
3cc80b6
update: vllm & sglang deploy guide
Browse files- docs/sglang_deploy_guide.md +108 -0
- docs/sglang_deploy_guide_cn.md +117 -0
- docs/vllm_deploy_guide.md +109 -0
- docs/vllm_deploy_guide_cn.md +119 -0
docs/sglang_deploy_guide.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax M2.1 Model SGLang Deployment Guide
|
| 2 |
+
|
| 3 |
+
[English Version](./sglang_deploy_guide.md) | [Chinese Version](./sglang_deploy_guide_cn.md)
|
| 4 |
+
|
| 5 |
+
We recommend using [SGLang](https://github.com/sgl-project/sglang) to deploy the [MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1) model. SGLang is a high-performance inference engine with excellent serving throughput, efficient and intelligent memory management, powerful batch request processing capabilities, and deeply optimized underlying performance. We recommend reviewing SGLang's official documentation to check hardware compatibility before deployment.
|
| 6 |
+
|
| 7 |
+
## Applicable Models
|
| 8 |
+
|
| 9 |
+
This document applies to the following models. You only need to change the model name during deployment.
|
| 10 |
+
|
| 11 |
+
- [MiniMaxAI/MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1)
|
| 12 |
+
- [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
|
| 13 |
+
|
| 14 |
+
The deployment process is illustrated below using MiniMax-M2.1 as an example.
|
| 15 |
+
|
| 16 |
+
## System Requirements
|
| 17 |
+
|
| 18 |
+
- OS: Linux
|
| 19 |
+
|
| 20 |
+
- Python: 3.9 - 3.12
|
| 21 |
+
|
| 22 |
+
- GPU:
|
| 23 |
+
|
| 24 |
+
- compute capability 7.0 or higher
|
| 25 |
+
|
| 26 |
+
- Memory requirements: 220 GB for weights, 240 GB per 1M context tokens
|
| 27 |
+
|
| 28 |
+
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 29 |
+
|
| 30 |
+
- 4x 96GB GPUs: Supported context length of up to 400K tokens.
|
| 31 |
+
|
| 32 |
+
- 8x 144GB GPUs: Supported context length of up to 3M tokens.
|
| 33 |
+
|
| 34 |
+
## Deployment with Python
|
| 35 |
+
|
| 36 |
+
It is recommended to use a virtual environment (such as **venv**, **conda**, or **uv**) to avoid dependency conflicts.
|
| 37 |
+
|
| 38 |
+
We recommend installing SGLang in a fresh Python environment:
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
uv venv
|
| 42 |
+
source .venv/bin/activate
|
| 43 |
+
uv pip install "sglang" --prerelease=allow
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Run the following command to start the SGLang server. SGLang will automatically download and cache the MiniMax-M2.1 model from Hugging Face.
|
| 47 |
+
|
| 48 |
+
4-GPU deployment command:
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
python -m sglang.launch_server \
|
| 52 |
+
--model-path MiniMaxAI/MiniMax-M2.1 \
|
| 53 |
+
--tp-size 4 \
|
| 54 |
+
--tool-call-parser minimax-m2 \
|
| 55 |
+
--reasoning-parser minimax-append-think \
|
| 56 |
+
--host 0.0.0.0 \
|
| 57 |
+
--trust-remote-code \
|
| 58 |
+
--port 8000 \
|
| 59 |
+
--mem-fraction-static 0.85
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
8-GPU deployment command:
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
python -m sglang.launch_server \
|
| 66 |
+
--model-path MiniMaxAI/MiniMax-M2.1 \
|
| 67 |
+
--tp-size 8 \
|
| 68 |
+
--ep-size 8 \
|
| 69 |
+
--tool-call-parser minimax-m2 \
|
| 70 |
+
--trust-remote-code \
|
| 71 |
+
--host 0.0.0.0 \
|
| 72 |
+
--reasoning-parser minimax-append-think \
|
| 73 |
+
--port 8000 \
|
| 74 |
+
--mem-fraction-static 0.85
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Testing Deployment
|
| 78 |
+
|
| 79 |
+
After startup, you can test the SGLang OpenAI-compatible API with the following command:
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 83 |
+
-H "Content-Type: application/json" \
|
| 84 |
+
-d '{
|
| 85 |
+
"model": "MiniMaxAI/MiniMax-M2.1",
|
| 86 |
+
"messages": [
|
| 87 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 88 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 89 |
+
]
|
| 90 |
+
}'
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
## Common Issues
|
| 94 |
+
|
| 95 |
+
### MiniMax-M2 model is not currently supported
|
| 96 |
+
|
| 97 |
+
Please upgrade to the latest stable version, >= v0.5.4.post1.
|
| 98 |
+
|
| 99 |
+
## Getting Support
|
| 100 |
+
|
| 101 |
+
If you encounter any issues while deploying the MiniMax model:
|
| 102 |
+
|
| 103 |
+
- Contact our technical support team through official channels such as email at [model@minimax.io](mailto:model@minimax.io)
|
| 104 |
+
|
| 105 |
+
- Submit an issue on our [GitHub](https://github.com/MiniMax-AI) repository
|
| 106 |
+
|
| 107 |
+
We continuously optimize the deployment experience for our models. Feedback is welcome!
|
| 108 |
+
|
docs/sglang_deploy_guide_cn.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax M2.1 模型 SGLang 部署指南
|
| 2 |
+
|
| 3 |
+
[英文版](./sglang_deploy_guide.md) | [中文版](./sglang_deploy_guide_cn.md)
|
| 4 |
+
|
| 5 |
+
我们推荐使用 [SGLang](https://github.com/sgl-project/sglang) 来部署 [MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1) 模型。SGLang 是一个高性能的推理引擎,其具有卓越的服务吞吐、高效智能的内存管理机制、强大的批量请求处理能力、深度优化的底层性能等特性。我们建议在部署之前查看 SGLang 的官方文档以检查硬件兼容性。
|
| 6 |
+
|
| 7 |
+
## 本文档适用模型
|
| 8 |
+
|
| 9 |
+
本文档适用以下模型,只需在部署时修改模型名称即可。
|
| 10 |
+
|
| 11 |
+
- [MiniMaxAI/MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1)
|
| 12 |
+
- [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
|
| 13 |
+
|
| 14 |
+
以下以 MiniMax-M2.1 为例说明部署流程。
|
| 15 |
+
|
| 16 |
+
## 环境要求
|
| 17 |
+
|
| 18 |
+
- OS:Linux
|
| 19 |
+
|
| 20 |
+
- Python:3.9 - 3.12
|
| 21 |
+
|
| 22 |
+
- GPU:
|
| 23 |
+
|
| 24 |
+
- compute capability 7.0 or higher
|
| 25 |
+
|
| 26 |
+
- 显存需求:权重需要 220 GB,每 1M 上下文 token 需要 240 GB
|
| 27 |
+
|
| 28 |
+
以下为推荐配置,实际需求请根据业务场景调整:
|
| 29 |
+
|
| 30 |
+
- 96G x4 GPU:支持 40 万 token 的总上下文。
|
| 31 |
+
|
| 32 |
+
- 144G x8 GPU:支持长达 300 万 token 的总上下文。
|
| 33 |
+
|
| 34 |
+
## 使用 Python 部署
|
| 35 |
+
|
| 36 |
+
建议使用虚拟环境(如 **venv**、**conda**、**uv**)以避免依赖冲突。
|
| 37 |
+
|
| 38 |
+
建议在全新的 Python 环境中安装 SGLang:
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
uv venv
|
| 42 |
+
source .venv/bin/activate
|
| 43 |
+
uv pip install "sglang" --prerelease=allow
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
运行如下命令启动 SGLang 服务器,SGLang 会自动从 Huggingface 下载并缓存 MiniMax-M2.1 模型。
|
| 47 |
+
|
| 48 |
+
4 卡部署命令:
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
python -m sglang.launch_server \
|
| 52 |
+
--model-path MiniMaxAI/MiniMax-M2.1 \
|
| 53 |
+
--tp-size 4 \
|
| 54 |
+
--tool-call-parser minimax-m2 \
|
| 55 |
+
--reasoning-parser minimax-append-think \
|
| 56 |
+
--host 0.0.0.0 \
|
| 57 |
+
--trust-remote-code \
|
| 58 |
+
--port 8000 \
|
| 59 |
+
--mem-fraction-static 0.85
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
8 卡部署命令:
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
python -m sglang.launch_server \
|
| 66 |
+
--model-path MiniMaxAI/MiniMax-M2.1 \
|
| 67 |
+
--tp-size 8 \
|
| 68 |
+
--ep-size 8 \
|
| 69 |
+
--tool-call-parser minimax-m2 \
|
| 70 |
+
--trust-remote-code \
|
| 71 |
+
--host 0.0.0.0 \
|
| 72 |
+
--reasoning-parser minimax-append-think \
|
| 73 |
+
--port 8000 \
|
| 74 |
+
--mem-fraction-static 0.85
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## 测试部署
|
| 78 |
+
|
| 79 |
+
启动后,可以通过如下命令测试 SGLang OpenAI 兼容接口:
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 83 |
+
-H "Content-Type: application/json" \
|
| 84 |
+
-d '{
|
| 85 |
+
"model": "MiniMaxAI/MiniMax-M2.1",
|
| 86 |
+
"messages": [
|
| 87 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 88 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 89 |
+
]
|
| 90 |
+
}'
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
## 常见问题
|
| 94 |
+
|
| 95 |
+
### Huggingface 网络问题
|
| 96 |
+
|
| 97 |
+
如果遇到网络问题,可以设置代理后再进行拉取。
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
export HF_ENDPOINT=https://hf-mirror.com
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### MiniMax-M2 model is not currently supported
|
| 104 |
+
|
| 105 |
+
请升级到最新的稳定版本, >= v0.5.4.post1.
|
| 106 |
+
|
| 107 |
+
## 获取支持
|
| 108 |
+
|
| 109 |
+
如果在部署 MiniMax 模型过程中遇到任何问题:
|
| 110 |
+
|
| 111 |
+
- 通过邮箱 [model@minimax.io](mailto:model@minimax.io) 等官方渠道联系我们的技术支持团队
|
| 112 |
+
|
| 113 |
+
- 在我们的 [GitHub](https://github.com/MiniMax-AI) 仓库提交 Issue
|
| 114 |
+
|
| 115 |
+
- 通过我们的 [官方企业微信交流群](https://github.com/MiniMax-AI/MiniMax-AI.github.io/blob/main/images/wechat-qrcode.jpeg) 反馈
|
| 116 |
+
|
| 117 |
+
我们会持续优化模型的部署体验,欢迎反馈!
|
docs/vllm_deploy_guide.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax M2.1 Model vLLM Deployment Guide
|
| 2 |
+
|
| 3 |
+
[English Version](./vllm_deploy_guide.md) | [Chinese Version](./vllm_deploy_guide_cn.md)
|
| 4 |
+
|
| 5 |
+
We recommend using [vLLM](https://docs.vllm.ai/en/stable/) to deploy the [MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1) model. vLLM is a high-performance inference engine with excellent serving throughput, efficient and intelligent memory management, powerful batch request processing capabilities, and deeply optimized underlying performance. We recommend reviewing vLLM's official documentation to check hardware compatibility before deployment.
|
| 6 |
+
|
| 7 |
+
## Applicable Models
|
| 8 |
+
|
| 9 |
+
This document applies to the following models. You only need to change the model name during deployment.
|
| 10 |
+
|
| 11 |
+
- [MiniMaxAI/MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1)
|
| 12 |
+
|
| 13 |
+
The deployment process is illustrated below using MiniMax-M2.1 as an example.
|
| 14 |
+
|
| 15 |
+
## System Requirements
|
| 16 |
+
|
| 17 |
+
- OS: Linux
|
| 18 |
+
|
| 19 |
+
- Python: 3.9 - 3.12
|
| 20 |
+
|
| 21 |
+
- GPU:
|
| 22 |
+
|
| 23 |
+
- compute capability 7.0 or higher
|
| 24 |
+
|
| 25 |
+
- Memory requirements: 220 GB for weights, 240 GB per 1M context tokens
|
| 26 |
+
|
| 27 |
+
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 28 |
+
|
| 29 |
+
- 4x 96GB GPUs: Supported context length of up to 400K tokens.
|
| 30 |
+
|
| 31 |
+
- 8x 144GB GPUs: Supported context length of up to 3M tokens.
|
| 32 |
+
|
| 33 |
+
## Deployment with Python
|
| 34 |
+
|
| 35 |
+
It is recommended to use a virtual environment (such as **venv**, **conda**, or **uv**) to avoid dependency conflicts.
|
| 36 |
+
|
| 37 |
+
We recommend installing vLLM in a fresh Python environment:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
uv venv
|
| 41 |
+
source .venv/bin/activate
|
| 42 |
+
uv pip install -U vllm
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
Run the following command to start the vLLM server. vLLM will automatically download and cache the MiniMax-M2.1 model from Hugging Face.
|
| 46 |
+
|
| 47 |
+
4-GPU deployment command:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
SAFETENSORS_FAST_GPU=1 vllm serve \
|
| 51 |
+
MiniMaxAI/MiniMax-M2.1 --trust-remote-code \
|
| 52 |
+
--tensor-parallel-size 4 \
|
| 53 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 54 |
+
--reasoning-parser minimax_m2_append_think
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
8-GPU deployment command:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
SAFETENSORS_FAST_GPU=1 vllm serve \
|
| 61 |
+
MiniMaxAI/MiniMax-M2.1 --trust-remote-code \
|
| 62 |
+
--enable_expert_parallel --tensor-parallel-size 8 \
|
| 63 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 64 |
+
--reasoning-parser minimax_m2_append_think
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Testing Deployment
|
| 68 |
+
|
| 69 |
+
After startup, you can test the vLLM OpenAI-compatible API with the following command:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 73 |
+
-H "Content-Type: application/json" \
|
| 74 |
+
-d '{
|
| 75 |
+
"model": "MiniMaxAI/MiniMax-M2.1",
|
| 76 |
+
"messages": [
|
| 77 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 78 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 79 |
+
]
|
| 80 |
+
}'
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Common Issues
|
| 84 |
+
|
| 85 |
+
### MiniMax-M2 model is not currently supported
|
| 86 |
+
|
| 87 |
+
This vLLM version is outdated. Please upgrade to the latest version.
|
| 88 |
+
|
| 89 |
+
### torch.AcceleratorError: CUDA error: an illegal memory access was encountered
|
| 90 |
+
Add `--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"` to the startup parameters to resolve this issue. For example:
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
SAFETENSORS_FAST_GPU=1 vllm serve \
|
| 94 |
+
MiniMaxAI/MiniMax-M2.1 --trust-remote-code \
|
| 95 |
+
--enable_expert_parallel --tensor-parallel-size 8 \
|
| 96 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 97 |
+
--reasoning-parser minimax_m2_append_think \
|
| 98 |
+
--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Getting Support
|
| 102 |
+
|
| 103 |
+
If you encounter any issues while deploying the MiniMax model:
|
| 104 |
+
|
| 105 |
+
- Contact our technical support team through official channels such as email at [model@minimax.io](mailto:model@minimax.io)
|
| 106 |
+
|
| 107 |
+
- Submit an issue on our [GitHub](https://github.com/MiniMax-AI) repository
|
| 108 |
+
|
| 109 |
+
We continuously optimize the deployment experience for our models. Feedback is welcome!
|
docs/vllm_deploy_guide_cn.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax M2.1 模型 vLLM 部署指南
|
| 2 |
+
|
| 3 |
+
[英文版](./vllm_deploy_guide.md) | [中文版](./vllm_deploy_guide_cn.md)
|
| 4 |
+
|
| 5 |
+
我们推荐使用 [vLLM](https://docs.vllm.ai/en/stable/) 来部署 [MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1) 模型。vLLM 是一个高性能的推理引擎,其具有卓越的服务吞吐、高效智能的内存管理机制、强大的批量请求处理能力、深度优化的底层性能等特性。我们建议在部署之前查看 vLLM 的官方文档以检查硬件兼容性。
|
| 6 |
+
|
| 7 |
+
## 本文档适用模型
|
| 8 |
+
|
| 9 |
+
本文档适用以下模型,只需在部署时修改模型名称即可。
|
| 10 |
+
|
| 11 |
+
- [MiniMaxAI/MiniMax-M2.1](https://huggingface.co/MiniMaxAI/MiniMax-M2.1)
|
| 12 |
+
|
| 13 |
+
以下以 MiniMax-M2.1 为例说明部署流程。
|
| 14 |
+
|
| 15 |
+
## 环境要求
|
| 16 |
+
|
| 17 |
+
- OS:Linux
|
| 18 |
+
|
| 19 |
+
- Python:3.9 - 3.12
|
| 20 |
+
|
| 21 |
+
- GPU:
|
| 22 |
+
|
| 23 |
+
- compute capability 7.0 or higher
|
| 24 |
+
|
| 25 |
+
- 显存需求:权重需要 220 GB,每 1M 上下文 token 需要 240 GB
|
| 26 |
+
|
| 27 |
+
以下为推荐配置,实际需求请根据业务场景调整:
|
| 28 |
+
|
| 29 |
+
- 96G x4 GPU:支持 40 万 token 的总上下文。
|
| 30 |
+
|
| 31 |
+
- 144G x8 GPU:支持长达 300 万 token 的总上下文。
|
| 32 |
+
|
| 33 |
+
## 使用 Python 部署
|
| 34 |
+
|
| 35 |
+
建议使用虚拟环境(如 **venv**、**conda**、**uv**)以避免依赖冲突。
|
| 36 |
+
|
| 37 |
+
建议在全新的 Python 环境中安装 vLLM:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
uv venv
|
| 41 |
+
source .venv/bin/activate
|
| 42 |
+
uv pip install -U vllm
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
运行如下命令启动 vLLM 服务器,vLLM 会自动从 Huggingface 下载并缓存 MiniMax-M2.1 模型。
|
| 46 |
+
|
| 47 |
+
4 卡部署命令:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
SAFETENSORS_FAST_GPU=1 vllm serve \
|
| 51 |
+
MiniMaxAI/MiniMax-M2.1 --trust-remote-code \
|
| 52 |
+
--tensor-parallel-size 4 \
|
| 53 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 54 |
+
--reasoning-parser minimax_m2_append_think
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
8 卡部署命令:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
SAFETENSORS_FAST_GPU=1 vllm serve \
|
| 61 |
+
MiniMaxAI/MiniMax-M2.1 --trust-remote-code \
|
| 62 |
+
--enable_expert_parallel --tensor-parallel-size 8 \
|
| 63 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 64 |
+
--reasoning-parser minimax_m2_append_think
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## 测试部署
|
| 68 |
+
|
| 69 |
+
启动后,可以通过如下命令测试 vLLM OpenAI 兼容接口:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 73 |
+
-H "Content-Type: application/json" \
|
| 74 |
+
-d '{
|
| 75 |
+
"model": "MiniMaxAI/MiniMax-M2.1",
|
| 76 |
+
"messages": [
|
| 77 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 78 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 79 |
+
]
|
| 80 |
+
}'
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## 常见问题
|
| 84 |
+
|
| 85 |
+
### Huggingface 网络问题
|
| 86 |
+
|
| 87 |
+
如果遇到网络问题,可以设置代理后再进行拉取。
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
export HF_ENDPOINT=https://hf-mirror.com
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### MiniMax-M2 model is not currently supported
|
| 94 |
+
|
| 95 |
+
该 vLLM 版本过旧,请升级到最新版本。
|
| 96 |
+
|
| 97 |
+
### torch.AcceleratorError: CUDA error: an illegal memory access was encountered
|
| 98 |
+
在启动参数添加 `--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"` 可以解决。例如:
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
SAFETENSORS_FAST_GPU=1 vllm serve \
|
| 102 |
+
MiniMaxAI/MiniMax-M2.1 --trust-remote-code \
|
| 103 |
+
--enable_expert_parallel --tensor-parallel-size 8 \
|
| 104 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 105 |
+
--reasoning-parser minimax_m2_append_think \
|
| 106 |
+
--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## 获取支持
|
| 110 |
+
|
| 111 |
+
如果在部署 MiniMax 模型过程中遇到任何问题:
|
| 112 |
+
|
| 113 |
+
- 通过邮箱 [model@minimax.io](mailto:model@minimax.io) 等官方渠道联系我们的技术支持团队
|
| 114 |
+
|
| 115 |
+
- 在我们的 [GitHub](https://github.com/MiniMax-AI) 仓库提交 Issue
|
| 116 |
+
|
| 117 |
+
- 通过我们的 [官方企业微信交流群](https://github.com/MiniMax-AI/MiniMax-AI.github.io/blob/main/images/wechat-qrcode.jpeg) 反馈
|
| 118 |
+
|
| 119 |
+
我们会持续优化模型的部署体验,欢迎反馈!
|