# MiniMax-M2.7
## 论文
暂无
## 模型简介
MiniMax-M2.7 是 MiniMax 开源的 MiniMax-M2 系列模型之一,面向代码生成、Agent 工作流与复杂工具调用场景。根据官方公开资料,MiniMax-M2 系列采用 MoE 架构,总参数规模约为 230B,激活参数约为 10B,在保持通用文本生成能力的同时,重点强化了编码、多步规划和工具使用能力。
该系列还是一个 interleaved thinking 模型。官方说明要求在多轮对话中保留助手历史消息中的 `...` 内容,否则会影响模型效果。
## 环境依赖
| 软件 | 版本 |
| :------: |:-----------------------------------------:|
| DTK | 26.04 |
| python | 3.10.12 |
| transformers | 5.2.0.dev0 |
| vllm | 0.15.1+das.opt1.alpha.dtk2604.torch290.2604081832.gbcb2ba |
| triton | 3.3.0+das.opt2.dtk2604.torch290.20260331.g31542e |
| torch | 2.9.0+das.opt1.dtk2604.20260331.g4e3c1e7 |
当前仅支持定制镜像: harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm015-ubuntu22.04-dtk26.04-0409-modelzoo
- 挂载地址`-v` 根据实际模型情况修改
```bash
docker run -it \
--shm-size 60g \
--network=host \
--name minimax-m2.7 \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mkfd \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
-u root \
-v /opt/hyhal/:/opt/hyhal/:ro \
-v /path/your_code_data/:/path/your_code_data/ \
harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm015-ubuntu22.04-dtk26.04-0409-modelzoo bash
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装
## 数据集
暂无
## 训练
暂无
## 推理
1. 将FP8模型权重转换成BF16,转换方法如下:
```bash
python cast_model_dtype/fp8_cast_bf16.py --input-fp8-hf-path /path/of/MiniMax/MiniMax-M2.7/ --output-bf16-hf-path /path/of/MiniMax/MiniMax-M2.7-bf16
```
2. 相关模型文件拷贝:
```bash
cp /path/of/MiniMax/MiniMax-M2.7/config.json /path/of/MiniMax/MiniMax-M2.7-bf16
cp /path/of/MiniMax/MiniMax-M2.7/chat_template.jinja /path/of/MiniMax/MiniMax-M2.7-bf16
cp /path/of/MiniMax/MiniMax-M2.7/configuration.json /path/of/MiniMax/MiniMax-M2.7-bf16
cp /path/of/MiniMax/MiniMax-M2.7/generation_config.json /path/of/MiniMax/MiniMax-M2.7-bf16
cp /path/of/MiniMax/MiniMax-M2.7/configuration_minimax_m2.py /path/of/MiniMax/MiniMax-M2.7-bf16
cp /path/of/MiniMax/MiniMax-M2.7/tokenizer* /path/of/MiniMax/MiniMax-M2.7-bf16
cp /path/of/MiniMax/MiniMax-M2.7/vocab.json /path/of/MiniMax/MiniMax-M2.7-bf16
```
**删掉 `/path/of/MiniMax/MiniMax-M2.7-bf16/config.json` 中的 `quantization_config` 字段内容,如图所示**
### vllm
#### 单机推理
```bash
## serve启动
vllm serve /path/MiniMax-M2.7-bf16 \
--trust-remote-code \
--served-model-name minimax-m2.7 \
--gpu-memory-utilization 0.95 \
--max-model-len 4096 \
--dtype bfloat16 \
-tp 8 \
--port 8001 \
--enable-auto-tool-choice \
--tool-call-parser minimax_m2 \
--reasoning-parser minimax_m2 \
--enable-expert-parallel
## client访问
curl http://localhost:8001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-m2.7",
"messages": [
{
"role": "user",
"content": "牛顿提出了哪三大运动定律?请简要说明。"
}
]
}'
```
## 效果展示
### 精度
DCU与GPU精度一致,推理框架:vllm。
## 预训练权重
| 模型名称 | 权重大小 | DCU型号 | 最低卡数需求 | 下载地址 |
|:-----:|:----------:|:----------:|:---------------------:|:----------:|
| MiniMax-M2.7 | 229B | BW1000 | 8 | [ModelScope](https://www.modelscope.cn/models/MiniMax/MiniMax-M2.7/summary) |
| MiniMax-M2.7 | 229B | BW1100 | 4 | [ModelScope](https://www.modelscope.cn/models/MiniMax/MiniMax-M2.7/summary) |
## 源码仓库及问题反馈
- http://developer.sourcefind.cn/codes/modelzoo/minimax-m2.7_vllm
## 参考资料
- https://www.modelscope.cn/models/MiniMax/MiniMax-M2.7/summary
- https://huggingface.co/MiniMaxAI/MiniMax-M2.7
- https://github.com/MiniMax-AI/MiniMax-M2
- https://docs.vllm.ai/projects/recipes/en/latest/MiniMax/MiniMax-M2.html