镜像概述:昇腾 torch-onnx-inference 运行环境
快速参考
-
torch-onnx-inference 运行环境由 ModelZoo 社区 维护
-
从哪里获取帮助
- 支持硬件: Atlas 300I DUO / Atlas 800I A2
- 基础操作系统可选: Ubuntu 22.04 LTS (AArch64) / openEuler 24.03 LTS (AArch64)
- CANN 版本: 8.3.RC1
- 预装软件栈: Python 3.11, Miniconda, PyTorch 2.1.0, torch_npu, MindIE-SD, ais_bench, MSIT
torch-onnx-inference
torch-onnx-inference 是一种专为端侧场景定制的高性能深度学习推理部署与全栈开发运行环境。
本环境核心用于承载和运行 ModelZoo 仓内经典和主流算法模型的端到端推理流程。环境内无缝集成了 PyTorch 框架、torch_npu 昇腾原生加速库、MindIE-SD 以及全套 ONNX 图优化与性能基准测试工具链(onnxslim、ais_bench、MSIT)。
镜像 Tag 说明及 Dockerfile 归档路径
完整镜像路径 (<仓库地址>/<镜像名>:<Tag>) |
基础操作系统 | 目标硬件 | Dockerfile 归档路径 |
|---|---|---|---|
torch-onnx-inference:cann8.3.rc1_torch2.1.0-300I-DUO-ubuntu22.04-py3.11-aarch64 |
Ubuntu 22.04 | Atlas 300I DUO | ModelZoo-PyTorch/ACL_PyTorch/docker/cann8.3.rc1_torch2.1.0/Dockerfile.300IDUO.ubuntu |
torch-onnx-inference:cann8.3.rc1_torch2.1.0-300I-DUO-openeuler24.03-py3.11-aarch64 |
openEuler 24.03 | Atlas 300I DUO | ModelZoo-PyTorch/ACL_PyTorch/docker/cann8.3.rc1_torch2.1.0/Dockerfile.300IDUO.openeuler |
torch-onnx-inference:cann8.3.rc1_torch2.1.0-800I-A2-ubuntu22.04-py3.11-aarch64 |
Ubuntu 22.04 | Atlas 800I A2 | ModelZoo-PyTorch/ACL_PyTorch/docker/cann8.3.rc1_torch2.1.0/Dockerfile.800I_A2.ubuntu |
torch-onnx-inference:cann8.3.rc1_torch2.1.0-800I-A2-openeuler24.03-py3.11-aarch64 |
openEuler 24.03 | Atlas 800I A2 | ModelZoo-PyTorch/ACL_PyTorch/docker/cann8.3.rc1_torch2.1.0/Dockerfile.800I_A2.openeuler |
快速开始
前置条件
确保宿主机已正确安装昇腾 NPU 驱动和固件,且设备状态健康。
- 宿主机执行检查命令:
npu-smi info
运行容器
根据您的硬件类型选择对应的启动命令。
docker run -it -d --net=host --shm-size=1g \
--name <container-name> \
--device=/dev/davinci_manager:rwm \
--device=/dev/hisi_hdc:rwm \
--device=/dev/devmm_svm:rwm \
--device=/dev/davinci0:rwm \
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver:ro \
-v /usr/local/Ascend/firmware/:/usr/local/Ascend/firmware:ro \
-v /usr/local/sbin:/usr/local/sbin:ro \
-v /path-to-weights:/path-to-weights:ro \
torch-onnx-inference:cann8.3.rc1_torch2.1.0-800I-A2-openeuler24.03-py3.11-aarch64 bash
本地构建
如需在本地重新编译镜像,请至 docker 独立目录下执行:
以 Atlas 800I A2 openEuler 镜像为例
docker build \
-t <YOUR_IMAGE_REGISTRY>/torch-onnx-inference:cann8.3.rc1_torch2.1.0-800I-A2-openeuler24.03-py3.11-aarch64 \
-f ModelZoo-PyTorch/ACL_PyTorch/docker/cann8.3.rc1_torch2.1.0/Dockerfile.800I_A2.openeuler .
二次开发
进入容器:
docker exec -it torch-onnx-inference-800I-A2 bash
环境激活:容器默认集成了 Conda 环境,登录后会自动切入 base (Python 3.11)。
验证昇腾软件栈:
python3 -c "import torch; import torch_npu; print(torch.npu.is_available())"
硬件支持与兼容性说明
- 算力架构: 匹配昇腾 NPU(Atlas 300I DUO, Atlas 800I A2)。
- 驱动配套: 宿主机驱动版本需不低于 24.1.RC3 配套驱动,以确保向后兼容的算子正常编译与执行。
许可证与免责声明
torch-onnx-inference 1.0
Container image Copyright (c) 2026, Huawei Technologies Co., Ltd. All rights reserved. This container image and its contents are governed by the Huawei Container License Agreement ("Li cense"). By pulling and using the container, you accept the terms and conditions of this License. A copy of this License is made available in this container at: https://www.hiascend.com/en/legal/ascend hub-download Note: You agree and undertake that when using Huawei or third-party software in this image, you will comply with the license agreement of the corresponding Huawei or third-party software.