Upload docs/sglang_deploy_guide_cn.hf_temp_rename.md with huggingface_hub
Browse files
docs/sglang_deploy_guide_cn.hf_temp_rename.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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**:总 KV Cache 容量支持 40 万 token。
|
| 31 |
+
|
| 32 |
+
- **144G x8 GPU**:总 KV Cache 容量支持高达 300 万 token。
|
| 33 |
+
|
| 34 |
+
> **注**:以上数值为硬件支持的最大并发缓存总量,模型单序列(Single Sequence)长度上限仍为 196k。
|
| 35 |
+
|
| 36 |
+
## 使用 Python 部署
|
| 37 |
+
|
| 38 |
+
建议使用虚拟环境(如 **venv**、**conda**、**uv**)以避免依赖冲突。
|
| 39 |
+
|
| 40 |
+
建议在全新的 Python 环境中安装 SGLang:
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
uv venv
|
| 44 |
+
source .venv/bin/activate
|
| 45 |
+
git clone https://github.com/sgl-project/sglang
|
| 46 |
+
cd sglang
|
| 47 |
+
uv pip install -e "python" --prerelease=allow
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
运行如下命令启动 SGLang 服务器,SGLang 会自动从 Huggingface 下载并缓存 MiniMax-M2.1 模型。
|
| 51 |
+
|
| 52 |
+
4 卡部署命令:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
python -m sglang.launch_server \
|
| 56 |
+
--model-path MiniMaxAI/MiniMax-M2.1 \
|
| 57 |
+
--tp-size 4 \
|
| 58 |
+
--tool-call-parser minimax-m2 \
|
| 59 |
+
--reasoning-parser minimax-append-think \
|
| 60 |
+
--host 0.0.0.0 \
|
| 61 |
+
--trust-remote-code \
|
| 62 |
+
--port 8000 \
|
| 63 |
+
--mem-fraction-static 0.85
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
8 卡部署命令:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
python -m sglang.launch_server \
|
| 70 |
+
--model-path MiniMaxAI/MiniMax-M2.1 \
|
| 71 |
+
--tp-size 8 \
|
| 72 |
+
--ep-size 8 \
|
| 73 |
+
--tool-call-parser minimax-m2 \
|
| 74 |
+
--trust-remote-code \
|
| 75 |
+
--host 0.0.0.0 \
|
| 76 |
+
--reasoning-parser minimax-append-think \
|
| 77 |
+
--port 8000 \
|
| 78 |
+
--mem-fraction-static 0.85
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## 测试部署
|
| 82 |
+
|
| 83 |
+
启动后,可以通过如下命令测试 SGLang OpenAI 兼容接口:
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 87 |
+
-H "Content-Type: application/json" \
|
| 88 |
+
-d '{
|
| 89 |
+
"model": "MiniMaxAI/MiniMax-M2.1",
|
| 90 |
+
"messages": [
|
| 91 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 92 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 93 |
+
]
|
| 94 |
+
}'
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
## 常见问题
|
| 98 |
+
|
| 99 |
+
### Huggingface 网络问题
|
| 100 |
+
|
| 101 |
+
如果遇到网络问题,可以设置代理后再进行拉取。
|
| 102 |
+
|
| 103 |
+
```bash
|
| 104 |
+
export HF_ENDPOINT=https://hf-mirror.com
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
### MiniMax-M2 model is not currently supported
|
| 108 |
+
|
| 109 |
+
请升级到最新的稳定版本, >= v0.5.4.post1.
|
| 110 |
+
|
| 111 |
+
## 获取支持
|
| 112 |
+
|
| 113 |
+
如果在部署 MiniMax 模型过程中遇到任何问题:
|
| 114 |
+
|
| 115 |
+
- 通过邮箱 [model@minimax.io](mailto:model@minimax.io) 等官方渠道联系我们的技术支持团队
|
| 116 |
+
|
| 117 |
+
- 在我们的 [GitHub](https://github.com/MiniMax-AI) 仓库提交 Issue
|
| 118 |
+
|
| 119 |
+
- 通过我们的 [官方企业微信交流群](https://github.com/MiniMax-AI/MiniMax-AI.github.io/blob/main/images/wechat-qrcode.jpeg) 反馈
|
| 120 |
+
|
| 121 |
+
我们会持续优化模型的部署体验,欢迎反馈!
|