本文档介绍在A3平台上,基于vLLM推理引擎进行Kimi-VL-A3B-Instruct模型的推理指导。
Kimi-VL-A3B-Instruct 是由 月之暗面(Moonshot AI)于 2025 年 4 月开源的高效多模态视觉语言模型(VLM),属于 Kimi-VL 系列的指令调优版本,专为通用多模态感知和理解任务设计,兼顾性能与部署效率。
| 型号 | 卡数 | 模型 |
|---|---|---|
| 910C | 1 | Kimi-VL-A3B-Instruct (单卡) |
| 910C | 8 | Kimi-VL-A3B-Instruct (单节点8卡) |
| 软件名 | 版本 |
|---|---|
| CANN | 8.5.0 |
| Python | Python 3.11.14 |
| hdk | 25.5.0 |
| torch | 2.8.0 |
| torch-npu | 2.8.0.post2 |
| vllm | v0.13.0 |
Kimi-VL-A3B-Instruct/
├── docker/ # Docker 相关文件
│ ├── Dockerfile # 自定义镜像(可选SSH支持)
│ └── entrypoint.sh # 容器入口脚本
├── scripts/ # 部署脚本
│ ├── deploy/ # 一键部署脚本(推荐)
│ │ ├── deploy_single.sh
│ │ └── deploy_8npu.sh
│ ├── start/ # 启动服务脚本
│ │ ├── start_single.sh
│ │ └── start_8npu.sh
│ └── tools/ # 辅助工具脚本
│ ├── download_model.sh
│ ├── pull_image.sh
│ ├── test_service.sh
│ ├── eval_accuracy.sh
│ └── eval_performance.sh
├── test_assets/ # 测试资源
│ └── Kimi-logo-2025.png # Kimi Logo测试图片
└── README.md# 基础部署(不启用SSH,通过docker exec连接)
bash scripts/deploy/deploy_single.sh
# 启用SSH支持(用于Agent自动连接)
bash scripts/deploy/deploy_single.sh --with-ssh
# 启用SSH并指定密码
bash scripts/deploy/deploy_single.sh --with-ssh --ssh-password "your_password"# 方式1: docker exec(推荐)
docker exec -it kimi-vl-a3b-instruct bash
# 方式2: SSH(需启用--with-ssh选项)
ssh -p 2022 root@<宿主机IP>
# 默认密码: kimi@2025bash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/tools/download_model.shbash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/start/start_single.shbash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/tools/test_service.sh http://localhost:2036支持两种并行模式:
| 模式 | 参数 | 说明 |
|---|---|---|
| 张量并行 | --tensor-parallel-size 8 | 适合通用场景 |
| 专家并行 | --enable-expert-parallel | 适合MoE模型,优化专家计算 |
| 参数 | 值 | 说明 |
|---|---|---|
| tensor-parallel-size | 8 | 张量并行数 |
| WORLD_SIZE | 8 | 总卡数 |
| LOCAL_WORLD_SIZE | 8 | 本节点卡数 |
# 基础部署(不启用SSH)
bash scripts/deploy/deploy_8npu.sh
# 启用SSH支持
bash scripts/deploy/deploy_8npu.sh --with-ssh
# 启用SSH并指定密码
bash scripts/deploy/deploy_8npu.sh --with-ssh --ssh-password "your_password"# 在容器内执行
bash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/start/start_8npu.shKimi-VL-A3B-Instruct 是 MoE 模型(64个路由专家 + 2个共享专家),支持专家并行以优化推理性能。
source /usr/local/Ascend/cann-8.5.1/set_env.sh
export LD_LIBRARY_PATH=/usr/local/Ascend/nnal/atb/8.5.1/atb/cxx_abi_0/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/python3.11.14/bin:$PATH
vllm serve /mnt/Kimi-VL-A3B-Instruct \
--served-model-name Kimi-VL-A3B-Instruct \
--host 0.0.0.0 \
--port 2036 \
--max-model-len 8192 \
--max-num-batched-tokens 512 \
--gpu-memory-utilization 0.7 \
--no-enable-prefix-caching \
--seed 1024 \
--trust-remote-code \
--dtype float16 \
--tensor-parallel-size 8 \
--enable-expert-parallel \
--allowed-local-media-path /mnt# 方式1: docker exec(推荐)
docker exec -it kimi-vl-a3b-instruct-8npu bash
# 方式2: SSH(需启用--with-ssh选项)
ssh -p 2022 root@<宿主机IP>
# 默认密码: kimi@2025bash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/tools/test_service.sh http://localhost:2036仓库已包含测试图片 test_assets/Kimi-logo-2025.png,可直接测试视觉功能:
# 在容器内执行
bash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/tools/test_service.sh http://localhost:2036手动测试:
curl http://localhost:2036/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Kimi-VL-A3B-Instruct",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "描述这张图片的内容"},
{"type": "image_url", "image_url": {"url": "file:///mnt/scripts/Kimi-VL-A3B-Instruct/test_assets/Kimi-logo-2025.png"}}
]
}
]
}'bash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/tools/eval_accuracy.sh http://localhost:2036/v1/bash /mnt/scripts/Kimi-VL-A3B-Instruct/scripts/tools/eval_performance.sh http://localhost:2036/v1/chat/completions检查设备映射是否正确,确保 /dev/davinci_manager 等设备存在
tail -f /mnt/vllm-logs/kimi_vllm_*.logsource /usr/local/Ascend/cann-8.5.1/set_env.sh
export LD_LIBRARY_PATH=/usr/local/Ascend/nnal/atb/8.5.1/atb/cxx_abi_0/lib:$LD_LIBRARY_PATH调整 --gpu-memory-utilization 参数,降低显存利用率