torch-npu

ascendai/torch-npu Docker Image

1 次收藏下载次数: 0状态:社区镜像维护者:昇腾 Ascend AI 容器镜像仓库类型:镜像最近更新:

TorchNPU

The plugin is a deep learning adaptation framework based on Atlas, enabling Atlas NPUs to support the PyTorch framework and providing users of the PyTorch framework with the powerful computing power of Atlas AI processors.

Quick Reference

  • TorchNPU is maintained by the https://www.hiascend.com/eng/developer/software/ai-frameworks/pytorch

  • Where to get help

    • https://www.hiascend.com/en/developer/ascendhub
    • https://www.hiascend.com/document/detail/en/Pytorch/latest/index/index.html
    • https://www.hiascend.com/en
    • Issue Feedback

Supported Tags and Dockerfile Usage

Tag Specification

Tags follow the format:

text
<TorchNPU_version>-<CANN_version>-<chip>-<os>-<python_version>
FieldvalueDescription
TorchNPU Version2.14.0For details, see the version notes in the readme.
CANN_version9.2.0For details, see the version notes in the readme.
ChipSpecific example values can be found in the CANN mirrorchip model identifier
OSubuntu22.04 / openeuler24.03OS distribution used for the base image
Python Versionpy3.12Major Python version pre-installed in the image

Tag list for version 26.2.0

As shown below are all the image tags of the latest 26.2.0 version released by TorchNPU. For all the historical versions, please refer to Supported Tags

  • 2.14.0-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.14.0-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.14.0-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.14.0-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.14.0-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.14.0-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.14.0-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.14.0-cann9.2.0-950-openeuler24.03-py3.12
  • 2.13.0-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.13.0-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.13.0-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.13.0-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.13.0-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.13.0-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.13.0-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.13.0-cann9.2.0-950-openeuler24.03-py3.12
  • 2.12.0.post3-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.12.0.post3-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.12.0.post3-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.12.0.post3-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.12.0.post3-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.12.0.post3-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.12.0.post3-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.12.0.post3-cann9.2.0-950-openeuler24.03-py3.12
  • 2.11.0.post3-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.11.0.post3-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.11.0.post3-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.11.0.post3-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.11.0.post3-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.11.0.post3-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.11.0.post3-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.11.0.post3-cann9.2.0-950-openeuler24.03-py3.12
  • 2.10.0.post7-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.10.0.post7-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.10.0.post7-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.10.0.post7-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.10.0.post7-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.10.0.post7-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.10.0.post7-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.10.0.post7-cann9.2.0-950-openeuler24.03-py3.12
  • 2.9.0.post9-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.9.0.post9-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.9.0.post9-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.9.0.post9-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.9.0.post9-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.9.0.post9-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.9.0.post9-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.9.0.post9-cann9.2.0-950-openeuler24.03-py3.12
  • 2.7.1.post11-cann9.2.0-310p-ubuntu22.04-py3.12
  • 2.7.1.post11-cann9.2.0-310p-openeuler24.03-py3.12
  • 2.7.1.post11-cann9.2.0-910b-ubuntu22.04-py3.12
  • 2.7.1.post11-cann9.2.0-910b-openeuler24.03-py3.12
  • 2.7.1.post11-cann9.2.0-a3-ubuntu22.04-py3.12
  • 2.7.1.post11-cann9.2.0-a3-openeuler24.03-py3.12
  • 2.7.1.post11-cann9.2.0-950-ubuntu22.04-py3.12
  • 2.7.1.post11-cann9.2.0-950-openeuler24.03-py3.12

Dockerfile build parameters

See dockerfile:dockerfile

parametersDescriptionRequiredReference SourceValue
TORCH_VERSIONFull TorchNPU version numberYesTorchNPU repo releases2.14.0
CHIP_ARCHchip architecture identifierYesCANN image tag rulesSpecific example values can be found in the CANN mirror
OSBase image operating systemYesCANN image tag rulesubuntu / openeuler
OS_VERSIONOperating system versionYesCANN image tag rules22.04 / 24.03
PY_VERSIONPython version pre-installed in base imageYesCANN image tag rules3.11
CANN_VERSIONCANN toolkit versionYesCANN base image repo9.2.0
ARCHHost hardware architectureYesEnvironment hardwarearm / x86
PY_TAGPython package ABI tag (cp + version number)YesStrictly match PY_VERSIONcp311
TORCH_NPU_RELEASE_VERSIONOfficial TorchNPU release tag (including PyTorch version)YesTorchNPU repo releasesv26.2.0-pytorch2.14.0
TORCH_NPU_PATCH_TAGTorchNPU version number in the release package nameYesTorchNPU repo releases2.14.0
MANYLINUX_VERPyPI package compatible system versionNotorch official wheel specmanylinux_2_28
PIP_MIRROR_URLpip installation source URL (Tsinghua mirror by default)NoPyPI mirror sourceshttps://pypi.tuna.tsinghua.edu.cn/simple

Parameter Sources

  1. Image tags, operating systems, and version information:https://quay.io/repository/ascend/cann?tab=tags tag

  2. TORCH_NPU_RELEASE_VERSION and TORCH_NPU_PATCH_TAG parameter values are from TorchNPU Official Release Versions. Example with a wheel download URL:

[***]

  • TORCH_NPU_RELEASE_VERSION is the part between download/ and /torch_npu-, e.g. v26.2.0-pytorch2.14.0.
  • TORCH_NPU_PATCH_TAG is the part between torch_npu- and -cp310, e.g. 2.14.0.

Quick Start

Build TorchNPU Image

Taking the construction of the 2.14.0-a3-ubuntu22.04-py3.12 image as an example:

bash
docker build \
  --build-arg CHIP_ARCH=a3 \
  --build-arg OS=ubuntu \
  --build-arg OS_VERSION=22.04 \
  --build-arg PY_VERSION=3.11 \
  --build-arg CANN_VERSION=9.2.0 \
  --build-arg ARCH=arm \
  --build-arg PY_TAG=cp311 \
  --build-arg TORCH_NPU_RELEASE_TAG=v26.2.0-pytorch2.14.0 \
  --build-arg TORCH_NPU_PATCH_TAG=2.14.0 \
  -t image_name:tag \
  -f Dockerfile .

Note: If your build environment requires a proxy, pass proxy variables via --build-arg, for example:

bash
docker build \
  --build-arg HTTP_PROXY=http://proxy.example.com:8080 \
  --build-arg HTTPS_PROXY=http://proxy.example.com:8080 \
  --build-arg NO_PROXY=localhost,127.0.0.1 \
  ... \
  -f Dockerfile .

Replace the proxy address and port with your actual environment values.

Run TorchNPU Container

bash
docker run \
    --name pta_container \
    --device /dev/davinci1 \
    --device /dev/davinci_manager \
    --device /dev/devmm_svm \
    --device /dev/hisi_hdc \
    -v /usr/local/dcmi:/usr/local/dcmi \
    -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 \
    -it ascend/pta:tag bash

Running CANN containers on 950 series aarch64 architecture products

bash
docker run \
    --name pta_container \
    --device /dev/davinci1 \
    --device /dev/davinci_manager \
    --device /dev/hisi_hdc \
    --device /dev/ummu \
    --device /dev/uburma \
    -v /usr/local/dcmi:/usr/local/dcmi \
    -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 \
    -it ascend/pta:tag bash

Secondary Development

bash
# Use TorchNPU image as base image and add user software
FROM quay.io/ascend/torch-npu:2.14.0-cann9.2.0-910b-ubuntu22.04-py3.12 

RUN apt update -y && \
    apt install gcc ...

...

License/Disclaimer

See the license information for TorchNPU included in these images.

Like all container images, pre-installed software packages (Python, system libraries, etc.) may be subject to their own licenses.

The released Atlas software images are community versions; they are not intended for commercial use and serve solely as references for production practices. For detailed statements, please refer to https://www.hiascend.com/en/legal/ascendhub-download

Liability disclaimers are displayed in the image startup information and on the Atlas image platform.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 torch-npu 镜像标签

docker pull docker.xuanyuan.run/ascendai/torch-npu:<标签>

DockerHub 原生拉取命令

docker pull ascendai/torch-npu:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告