| 环境配置 | 配置说明 |
|---|---|
| 硬件配置 | Atlas A2 910B4(64G) |
| 驱动版本 | 25.2.3 |
| CANN版本 | 8.5.0 |
| 推理框架 | sglang |
| 推理镜像 | quay.io/ascend/sglang:v0.5.10-npu.rc1-910b |
| 部署方式 | 单机(8卡)部署 |
参考示例如下(v0.5.10-npu.rc1-910b 为镜像TAG,版本持续演进,可以拉取更新版本):
# 获取方式1:
docker pull quay.io/ascend/sglang:v0.5.10-npu.rc1-910b
# 获取方式2:
docker pull m.daocloud.io/quay.io/ascend/sglang:v0.5.10-npu.rc1-910b
# 获取方式3:
docker pull quay.nju.edu.cn/ascend/sglang:v0.5.10-npu.rc1-910b
| 配套 | 版本 |
|---|---|
| python | 3.11.14 |
| torch | 2.8.0+cpu |
| torch_npu | 2.8.0.post2 |
| sglang | 0.5.10rc1+npu |
| sgl_kernel_npu | 2026.3.1 |
| sglang-router | 0.3.2 |
可从下列参考地址下载量化权重:
modelscope社区:
下载命令参考:
# 如果环境中没有安装modelscope,先执行以下命令
pip install modelscope
# --local_dir:按需修改为指定的存储路径,如/root/.cache/models/
modelscope download --model Eco-Tech/MiniMax-M2.5-w8a8-QuaRot --local_dir /root/.cache/models/MiniMax-M2.5-w8a8-QuaRot# device 可按需挂载。示例为0-7卡 (Atlas A2: /dev/davinci[0-7] Atlas A3:/dev/davinci[0-15])
# 挂载目录需包含权重所在路径,示例为/root/.cache,可以根据实际情况指定
# 设置容器名称
export CONTAINER_NAME=MiniMax-M2.5-w8a8
# 选择镜像
export IMAGE=quay.io/ascend/sglang:v0.5.10-npu.rc1-910b
docker run --rm \
--name $CONTAINER_NAME \
--net=host \
--shm-size=512g \
--device /dev/davinci0 \
--device /dev/davinci1 \
--device /dev/davinci2 \
--device /dev/davinci3 \
--device /dev/davinci4 \
--device /dev/davinci5 \
--device /dev/davinci6 \
--device /dev/davinci7 \
--device /dev/davinci_manager \
--device /dev/devmm_svm \
--device /dev/hisi_hdc \
-v /usr/local/dcmi:/usr/local/dcmi \
-v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
-v /etc/ascend_install.info:/etc/ascend_install.info \
-v /etc/hccn.conf:/etc/hccn.conf \
-v /root/.cache:/root/.cache \
-it $IMAGE bash进入推理容器后,执行以下操作,启动推理服务
sysctl -w vm.swappiness=0
sysctl -w kernel.numa_balancing=0
sysctl -w kernel.sched_migration_cost_ns=50000
# bind cpu
export SGLANG_SET_CPU_AFFINITY=1
unset https_proxy
unset http_proxy
unset HTTPS_PROXY
unset HTTP_PROXY
unset ASCEND_LAUNCH_BLOCKING
# cann
source /usr/local/Ascend/ascend-toolkit/set_env.sh
source /usr/local/Ascend/nnal/atb/set_env.sh
export STREAMS_PER_DEVICE=32
export HCCL_BUFFSIZE=1024
export HCCL_OP_EXPANSION_MODE=AIV
MODEL_PATH="/root/.cache/models/MiniMax-M2.5-w8a8-QuaRot"
sglang serve \
--model-path $MODEL_PATH \
--attention-backend ascend \
--device npu \
--tp-size 8 \
--chunked-prefill-size 4096 --max-prefill-tokens 280000 \
--disable-radix-cache \
--trust-remote-code \
--host 0.0.0.0 \
--mem-fraction-static 0.9 \
--port 8000 \
--served-model-name mm2.5 \
--tool-call-parser minimax-m2 \
--reasoning-parser minimax-append-think \
--cuda-graph-bs 16 \
--quantization modelslim \
--enable-multimodal \
--mm-attention-backend ascend_attn \
> log-mm2.5-serve.log 2>&1 &curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "mm2.5",
"messages": [
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
]
}'
测试结果:
{"id":"4e543ea1e70947d79722a9a531d1daf8","object":"chat.completion","created":1778118242,"model":"mm2.5","choices":[{"index":0,"message":{"role":"assistant","content":"<think>The user asks: \"Who won the world series in 2020?\" That's a straightforward question: The Los Angeles Dodgers won the 2020 World Series. I should respond with that answer. No need for any extra content. There's no policy violation. Just answer.\n</think>\n\nThe Los Angeles Dodgers won the 2020 World Series.","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":"stop","matched_stop":200020}],"usage":{"prompt_tokens":32,"total_tokens":106,"completion_tokens":74,"prompt_tokens_details":null,"reasoning_tokens":55},"metadata":{"weight_version":"default"}}