已合并
[docs]v2.12.0-26.1.0文档产品名称更新 #40045
chenzhenxi创建于 7月3日
[docs]v2.12.0-26.1.0文档产品名称更新 #40045
已合并
共 9 个文件变更+130-105
| @@ -4,20 +4,20 @@ | |||
| 4 | 4 | ||
| 5 | ## Quick Reference | 5 | ## Quick Reference |
| 6 | 6 | ||
| 7 | -- PTA is maintained by the [Ascend PyTorch community](https://www.hiascend.com/developer/software/ai-frameworks/pytorch) | 7 | +- TorchNPU is maintained by the [Ascend for PyTorch community](https://www.hiascend.com/developer/software/ai-frameworks/pytorch) |
| 8 | 8 | ||
| 9 | - Where to get help | 9 | - Where to get help |
| 10 | 10 | ||
| 11 | - [AscendHub Image Repository](https://www.hiascend.com/developer/ascendhub) | 11 | - [AscendHub Image Repository](https://www.hiascend.com/developer/ascendhub) |
| 12 | - - [PTA Documentation](https://www.hiascend.com/document/detail/zh/Pytorch/730/index/index.html) | 12 | + - [TorchNPU Documentation](https://www.hiascend.com/document/detail/zh/Pytorch/730/index/index.html) |
| 13 | - [Ascend Developer Community](https://www.hiascend.com/developer) | 13 | - [Ascend Developer Community](https://www.hiascend.com/developer) |
| 14 | - [Issue Feedback](https://gitcode.com/Ascend/pytorch/issues) | 14 | - [Issue Feedback](https://gitcode.com/Ascend/pytorch/issues) |
| 15 | 15 | ||
| 16 | --- | 16 | --- |
| 17 | 17 | ||
| 18 | -## Ascend PyTorch | 18 | +## TorchNPU |
| 19 | 19 | ||
| 20 | -The Ascend Extension for PyTorch plugin is a deep learning adaptation framework based on Ascend, enabling Ascend NPUs to support the PyTorch framework and providing users of the PyTorch framework with the powerful computing power of Ascend AI processors. | 20 | +The TorchNPU plugin is a deep learning adaptation framework based on Ascend, enabling Ascend NPUs to support the PyTorch framework and providing users of the PyTorch framework with the powerful computing power of Ascend AI processors. |
| 21 | 21 | ||
| 22 | --- | 22 | --- |
| 23 | 23 | ||
| @@ -27,13 +27,13 @@ The Ascend Extension for PyTorch plugin is a deep learning adaptation framework | |||
| 27 | 27 | ||
| 28 | Tags follow the format: | 28 | Tags follow the format: |
| 29 | 29 | ||
| 30 | -``` | 30 | +```text |
| 31 | -<PTA_version>-<chip>-<os>-<python_version> | 31 | +<TorchNPU_version>-<chip>-<os>-<python_version> |
| 32 | ``` | 32 | ``` |
| 33 | 33 | ||
| 34 | | Field | Example Value | Description | | 34 | | Field | Example Value | Description | |
| 35 | |----------------|----------------------------|----------------------------------------------------------| | 35 | |----------------|----------------------------|----------------------------------------------------------| |
| 36 | -| PTA Version | v26.0.0-beta.1-torch2.10.0 | Version identifier in the official torch_npu release tag | | 36 | +| TorchNPU Version | v26.0.0-beta.1-torch2.10.0 | Version identifier in the official TorchNPU release tag | |
| 37 | | Chip | 910b / 310p / a3 | Ascend chip model identifier | | 37 | | Chip | 910b / 310p / a3 | Ascend chip model identifier | |
| 38 | | OS | ubuntu / openeuler | OS distribution used for the base image | | 38 | | OS | ubuntu / openeuler | OS distribution used for the base image | |
| 39 | | Python Version | py3.11 | Major Python version pre-installed in the image | | 39 | | Python Version | py3.11 | Major Python version pre-installed in the image | |
| @@ -42,7 +42,7 @@ Tags follow the format: | |||
| 42 | 42 | ||
| 43 | ### Build Argument Reference Links | 43 | ### Build Argument Reference Links |
| 44 | 44 | ||
| 45 | -1. Check torch_npu official releases / patch releases | 45 | +1. Check TorchNPU official releases / patch releases |
| 46 | 46 | ||
| 47 | https://gitcode.com/Ascend/pytorch/releases | 47 | https://gitcode.com/Ascend/pytorch/releases |
| 48 | 48 | ||
| @@ -61,8 +61,8 @@ Tags follow the format: | |||
| 61 | | PY_VERSION | Python version pre-installed in base image | Yes | CANN image tag rules | 3.11 | | 61 | | PY_VERSION | Python version pre-installed in base image | Yes | CANN image tag rules | 3.11 | |
| 62 | | ARCH | Host hardware architecture | Yes | Environment hardware | arm / x86 | | 62 | | ARCH | Host hardware architecture | Yes | Environment hardware | arm / x86 | |
| 63 | | PY_TAG | Python package ABI tag (cp + version number) | Yes | Strictly match PY_VERSION | cp311 (PY3.11) | | 63 | | PY_TAG | Python package ABI tag (cp + version number) | Yes | Strictly match PY_VERSION | cp311 (PY3.11) | |
| 64 | -| TORCH_NPU_RELEASE_VERSION | Official torch_npu release tag (including PyTorch version) | Yes | PTA repo releases | v26.0.0-beta.1-pytorch2.10.0 | | 64 | +| TORCH_NPU_RELEASE_VERSION | Official TorchNPU release tag (including PyTorch version) | Yes | TorchNPU repo releases | v26.0.0-beta.1-pytorch2.10.0 | |
| 65 | -| TORCH_VERSION | Full torch_npu version number | Yes | PTA repo releases | 2.10.0rc3 | | 65 | +| TORCH_VERSION | Full TorchNPU version number | Yes | TorchNPU repo releases | 2.10.0rc3 | |
| 66 | | MANYLINUX_VER | PyPI package compatible system version | No | torch official wheel spec | manylinux_2_28 | | 66 | | MANYLINUX_VER | PyPI package compatible system version | No | torch official wheel spec | manylinux_2_28 | |
| 67 | | PIP_MIRROR_URL | pip installation source URL (Tsinghua mirror by default) | No | PyPI mirror sources | https://pypi.tuna.tsinghua.edu.cn/simple | | 67 | | PIP_MIRROR_URL | pip installation source URL (Tsinghua mirror by default) | No | PyPI mirror sources | https://pypi.tuna.tsinghua.edu.cn/simple | |
| 68 | 68 | ||
| @@ -74,7 +74,7 @@ Tags follow the format: | |||
| 74 | 74 | ||
| 75 | ## Quick Start | 75 | ## Quick Start |
| 76 | 76 | ||
| 77 | -### Build PTA Image | 77 | +### Build TorchNPU Image |
| 78 | 78 | ||
| 79 | ```bash | 79 | ```bash |
| 80 | docker build \ | 80 | docker build \ |
| @@ -92,7 +92,7 @@ docker build \ | |||
| 92 | -f Dockerfile . | 92 | -f Dockerfile . |
| 93 | ``` | 93 | ``` |
| 94 | 94 | ||
| 95 | -### Run PTA Container | 95 | +### Run TorchNPU Container |
| 96 | 96 | ||
| 97 | ```bash | 97 | ```bash |
| 98 | docker run \ | 98 | docker run \ |
| @@ -118,7 +118,7 @@ docker buildx build -t {your_repo}/pta:latest -f Dockerfile . | |||
| 118 | ### Secondary Development | 118 | ### Secondary Development |
| 119 | 119 | ||
| 120 | ```bash | 120 | ```bash |
| 121 | -# Use PTA image as base image and add user software | 121 | +# Use TorchNPU image as base image and add user software |
| 122 | FROM quay.io/ascend/ascend-pytorch:v26.0.0-beta.1-torch2.10.0-910b-ubuntu-py3.11-arm # Not yet published, example only, subject to change. | 122 | FROM quay.io/ascend/ascend-pytorch:v26.0.0-beta.1-torch2.10.0-910b-ubuntu-py3.11-arm # Not yet published, example only, subject to change. |
| 123 | 123 | ||
| 124 | RUN apt update -y && \ | 124 | RUN apt update -y && \ |
| @@ -141,6 +141,6 @@ RUN apt update -y && \ | |||
| 141 | 141 | ||
| 142 | ## License | 142 | ## License |
| 143 | 143 | ||
| 144 | -See the [license information](https://gitcode.com/Ascend/pytorch/blob/master/LICENSE) for PTA included in these images. | 144 | +See the [license information](https://gitcode.com/Ascend/pytorch/blob/master/LICENSE) for TorchNPU included in these images. |
| 145 | 145 | ||
| 146 | -Like all container images, pre-installed software packages (Python, system libraries, etc.) may be subject to their own licenses. | 146 | +Like all container images, pre-installed software packages (Python, system libraries, etc.) may be subject to their own licenses. |
| @@ -4,20 +4,20 @@ | |||
| 4 | 4 | ||
| 5 | ## 快速参考 | 5 | ## 快速参考 |
| 6 | 6 | ||
| 7 | -- PTA 由 [Ascend PyTorch community](https://www.hiascend.com/developer/software/ai-frameworks/pytorch) 维护 | 7 | +- TorchNPU 由 [Ascend for PyTorch community](https://www.hiascend.com/developer/software/ai-frameworks/pytorch) 维护 |
| 8 | 8 | ||
| 9 | - 从哪里获取帮助 | 9 | - 从哪里获取帮助 |
| 10 | 10 | ||
| 11 | - [AscendHub 镜像仓库](https://www.hiascend.com/developer/ascendhub) | 11 | - [AscendHub 镜像仓库](https://www.hiascend.com/developer/ascendhub) |
| 12 | - - [PTA 文档](https://www.hiascend.com/document/detail/zh/Pytorch/730/index/index.html) | 12 | + - [TorchNPU 文档](https://www.hiascend.com/document/detail/zh/Pytorch/730/index/index.html) |
| 13 | - [昇腾开发者社区](https://www.hiascend.com/developer) | 13 | - [昇腾开发者社区](https://www.hiascend.com/developer) |
| 14 | - [问题反馈](https://gitcode.com/Ascend/pytorch/issues) | 14 | - [问题反馈](https://gitcode.com/Ascend/pytorch/issues) |
| 15 | 15 | ||
| 16 | --- | 16 | --- |
| 17 | 17 | ||
| 18 | -## Ascend PyTorch | 18 | +## TorchNPU |
| 19 | 19 | ||
| 20 | -Ascend Extension for PyTorch插件是基于昇腾的深度学习适配框架,使昇腾NPU可以支持PyTorch框架,为PyTorch框架的使用者提供昇腾AI处理器的超强算力。 | 20 | +TorchNPU插件是基于昇腾的深度学习适配框架,使昇腾NPU可以支持PyTorch框架,为PyTorch框架的使用者提供昇腾AI处理器的超强算力。 |
| 21 | 21 | ||
| 22 | --- | 22 | --- |
| 23 | 23 | ||
| @@ -27,13 +27,13 @@ Ascend Extension for PyTorch插件是基于昇腾的深度学习适配框架, | |||
| 27 | 27 | ||
| 28 | Tag 遵循以下格式: | 28 | Tag 遵循以下格式: |
| 29 | 29 | ||
| 30 | -``` | 30 | +```text |
| 31 | -<PTA版本号>-<硬件信息(芯片)>-<操作系统>-<Python版本> | 31 | +<TorchNPU版本号>-<硬件信息(芯片)>-<操作系统>-<Python版本> |
| 32 | ``` | 32 | ``` |
| 33 | 33 | ||
| 34 | | 字段 | 示例值 | 说明 | | 34 | | 字段 | 示例值 | 说明 | |
| 35 | |-----------|----------------------------|------------------------------| | 35 | |-----------|----------------------------|------------------------------| |
| 36 | -| PTA 版本号 | v26.0.0-beta.1-torch2.10.0 | 对应 torch_npu 官方发布 Tag 中的版本标识 | | 36 | +| TorchNPU 版本号 | v26.0.0-beta.1-torch2.10.0 | 对应 TorchNPU 官方发布 Tag 中的版本标识 | |
| 37 | | 硬件信息(芯片) | 910b / 310p / a3 | 昇腾芯片型号标识 | | 37 | | 硬件信息(芯片) | 910b / 310p / a3 | 昇腾芯片型号标识 | |
| 38 | | 操作系统 | ubuntu / openeuler | 基础镜像所使用的操作系统发行版 | | 38 | | 操作系统 | ubuntu / openeuler | 基础镜像所使用的操作系统发行版 | |
| 39 | | Python 版本 | py3.11 | 镜像内置 Python 大版本号 | | 39 | | Python 版本 | py3.11 | 镜像内置 Python 大版本号 | |
| @@ -42,7 +42,7 @@ Tag 遵循以下格式: | |||
| 42 | 42 | ||
| 43 | ### 构建参数选择参考地址 | 43 | ### 构建参数选择参考地址 |
| 44 | 44 | ||
| 45 | -1. torch_npu 官方发布版本 / 补丁版本查询 | 45 | +1. TorchNPU 官方发布版本 / 补丁版本查询 |
| 46 | 46 | ||
| 47 | https://gitcode.com/Ascend/pytorch/releases | 47 | https://gitcode.com/Ascend/pytorch/releases |
| 48 | 48 | ||
| @@ -61,8 +61,8 @@ Tag 遵循以下格式: | |||
| 61 | | PY_VERSION | 基础镜像内置 Python 版本 | 是 | CANN 镜像标签规则 | 3.11 | | 61 | | PY_VERSION | 基础镜像内置 Python 版本 | 是 | CANN 镜像标签规则 | 3.11 | |
| 62 | | ARCH | 宿主机硬件架构 | 是 | 环境硬件 | arm / x86 | | 62 | | ARCH | 宿主机硬件架构 | 是 | 环境硬件 | arm / x86 | |
| 63 | | PY_TAG | Python 包 ABI 标签(cp + 版本号) | 是 | 与 PY_VERSION 严格匹配 | cp311 (PY3.11) | | 63 | | PY_TAG | Python 包 ABI 标签(cp + 版本号) | 是 | 与 PY_VERSION 严格匹配 | cp311 (PY3.11) | |
| 64 | -| TORCH_NPU_RELEASE_VERSION | torch_npu 官方发布 Tag(含 pytorch 版本) | 是 | PTA 仓库发行版 | v26.0.0-beta.1-pytorch2.10.0 | | 64 | +| TORCH_NPU_RELEASE_VERSION | TorchNPU 官方发布 Tag(含 pytorch 版本) | 是 | TorchNPU 仓库发行版 | v26.0.0-beta.1-pytorch2.10.0 | |
| 65 | -| TORCH_VERSION | torch_npu 完整版本号 | 是 | PTA 仓库发行版 | 2.10.0rc3 | | 65 | +| TORCH_VERSION | TorchNPU 完整版本号 | 是 | TorchNPU 仓库发行版 | 2.10.0rc3 | |
| 66 | | MANYLINUX_VER | PyPI 包兼容系统版本 | 否 | torch 官方 whl 规范 | manylinux_2_28 | | 66 | | MANYLINUX_VER | PyPI 包兼容系统版本 | 否 | torch 官方 whl 规范 | manylinux_2_28 | |
| 67 | | PIP_MIRROR_URL | pip 安装源地址(默认清华源) | 否 | PyPI 镜像源 | https://pypi.tuna.tsinghua.edu.cn/simple | | 67 | | PIP_MIRROR_URL | pip 安装源地址(默认清华源) | 否 | PyPI 镜像源 | https://pypi.tuna.tsinghua.edu.cn/simple | |
| 68 | 68 | ||
| @@ -74,7 +74,7 @@ Tag 遵循以下格式: | |||
| 74 | 74 | ||
| 75 | ## 快速开始 | 75 | ## 快速开始 |
| 76 | 76 | ||
| 77 | -### 构建 PTA 镜像 | 77 | +### 构建 TorchNPU 镜像 |
| 78 | 78 | ||
| 79 | ```bash | 79 | ```bash |
| 80 | docker build \ | 80 | docker build \ |
| @@ -92,7 +92,7 @@ docker build \ | |||
| 92 | -f Dockerfile . | 92 | -f Dockerfile . |
| 93 | ``` | 93 | ``` |
| 94 | 94 | ||
| 95 | -### 运行 PTA 容器 | 95 | +### 运行 TorchNPU 容器 |
| 96 | 96 | ||
| 97 | ```bash | 97 | ```bash |
| 98 | docker run \ | 98 | docker run \ |
| @@ -119,7 +119,7 @@ docker buildx build -t {your_repo}/pta:latest -f Dockerfile . | |||
| 119 | ### 如何二次开发 | 119 | ### 如何二次开发 |
| 120 | 120 | ||
| 121 | ```bash | 121 | ```bash |
| 122 | -# 以 PTA 镜像为基础镜像,叠加用户软件 | 122 | +# 以 TorchNPU 镜像为基础镜像,叠加用户软件 |
| 123 | FROM quay.io/ascend/ascend-pytorch:v26.0.0-beta.1-torch2.10.0-910b-ubuntu-py3.11 # 暂未发布,仅示例地址,仍需修改。 | 123 | FROM quay.io/ascend/ascend-pytorch:v26.0.0-beta.1-torch2.10.0-910b-ubuntu-py3.11 # 暂未发布,仅示例地址,仍需修改。 |
| 124 | 124 | ||
| 125 | RUN apt update -y && \ | 125 | RUN apt update -y && \ |
| @@ -142,6 +142,6 @@ RUN apt update -y && \ | |||
| 142 | 142 | ||
| 143 | ## 许可证 | 143 | ## 许可证 |
| 144 | 144 | ||
| 145 | -查看这些镜像中包含的 PTA 的[许可证信息](https://gitcode.com/Ascend/pytorch/blob/master/LICENSE)。 | 145 | +查看这些镜像中包含的 TorchNPU 的[许可证信息](https://gitcode.com/Ascend/pytorch/blob/master/LICENSE)。 |
| 146 | 146 | ||
| 147 | -与所有容器镜像一样,预装软件包(Python、系统库等)可能受其自身许可证约束。 | 147 | +与所有容器镜像一样,预装软件包(Python、系统库等)可能受其自身许可证约束。 |
| @@ -2,9 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | This folder hosts the `Dockerfile` to build docker images with various platforms. | 3 | This folder hosts the `Dockerfile` to build docker images with various platforms. |
| 4 | 4 | ||
| 5 | -## Build torch_npu from Docker container | 5 | +## Build TorchNPU from Docker container |
| 6 | 6 | ||
| 7 | -**Clone torch-npu** | 7 | +**Clone TorchNPU** |
| 8 | 8 | ||
| 9 | ```Shell | 9 | ```Shell |
| 10 | git clone https://gitcode.com/ascend/pytorch.git --depth 1 | 10 | git clone https://gitcode.com/ascend/pytorch.git --depth 1 |
| @@ -31,7 +31,7 @@ docker run -it -v /{code_path}/pytorch:/home/pytorch manylinux-builder:v1 bash | |||
| 31 | # {code_path} is the torch_npu source code path | 31 | # {code_path} is the torch_npu source code path |
| 32 | ``` | 32 | ``` |
| 33 | 33 | ||
| 34 | -**Compile torch_npu** | 34 | +**Compile TorchNPU** |
| 35 | 35 | ||
| 36 | Take Python 3.10 as an example | 36 | Take Python 3.10 as an example |
| 37 | 37 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | -# Ascend Extension for PyTorch | 1 | +# TorchNPU |
| 2 | 2 | ||
| 3 | ## Overview | 3 | ## Overview |
| 4 | 4 | ||
| 5 | -This repository develops the **Ascend Extension for PyTorch** named **torch_npu** to adapt **Ascend NPU** to **PyTorch** so that developers who use the **PyTorch** can obtain powerful compute capabilities of **Ascend AI Processors**. | 5 | +**TorchNPU** is a PyTorch adapter plugin that brings **Ascend NPU** support into the **PyTorch** ecosystem, enabling developers to harness the high-performance computing power of Ascend AI processors. |
| 6 | 6 | ||
| 7 | Ascend is a full-stack AI computing infrastructure for industry applications and services based on Huawei Ascend processors and software. For more information about Ascend, see [Ascend Community](https://www.hiascend.com/en/). | 7 | Ascend is a full-stack AI computing infrastructure for industry applications and services based on Huawei Ascend processors and software. For more information about Ascend, see [Ascend Community](https://www.hiascend.com/en/). |
| 8 | 8 | ||
| @@ -10,7 +10,7 @@ Ascend is a full-stack AI computing infrastructure for industry applications and | |||
| 10 | 10 | ||
| 11 | ### From Binary | 11 | ### From Binary |
| 12 | 12 | ||
| 13 | -Provide users with wheel package to quickly install **torch_npu**. Before installing **torch_npu**, complete the installation of **CANN** according to [Ascend Auxiliary Software](#ascend-auxiliary-software). To obtain the **CANN** installation package, refer to the [CANN Installation](https://www.hiascend.com/cann). | 13 | +Provide users with wheel package to quickly install **TorchNPU**. Before installing **TorchNPU**, complete the installation of **CANN** according to [Ascend Auxiliary Software](#ascend-auxiliary-software). To obtain the **CANN** installation package, refer to the [CANN Installation](https://www.hiascend.com/cann). |
| 14 | 14 | ||
| 15 | 1. **Install PyTorch** | 15 | 1. **Install PyTorch** |
| 16 | 16 | ||
| @@ -28,7 +28,7 @@ Provide users with wheel package to quickly install **torch_npu**. Before instal | |||
| 28 | pip3 install torch==2.12.0+cpu --index-url https://download.pytorch.org/whl/cpu | 28 | pip3 install torch==2.12.0+cpu --index-url https://download.pytorch.org/whl/cpu |
| 29 | ``` | 29 | ``` |
| 30 | 30 | ||
| 31 | -2. **Install torch-npu dependencies** | 31 | +2. **Install TorchNPU dependencies** |
| 32 | 32 | ||
| 33 | Run the following command to install dependencies. | 33 | Run the following command to install dependencies. |
| 34 | 34 | ||
| @@ -48,7 +48,7 @@ Provide users with wheel package to quickly install **torch_npu**. Before instal | |||
| 48 | | aarch64 | Python3.11 | [link](https://download-r2.pytorch.org/whl/cpu/torch-2.12.0%2Bcpu-cp311-cp311-manylinux_2_28_aarch64.whl) | | 48 | | aarch64 | Python3.11 | [link](https://download-r2.pytorch.org/whl/cpu/torch-2.12.0%2Bcpu-cp311-cp311-manylinux_2_28_aarch64.whl) | |
| 49 | | aarch64 | Python3.12 | [link](https://download-r2.pytorch.org/whl/cpu/torch-2.12.0%2Bcpu-cp312-cp312-manylinux_2_28_aarch64.whl) | | 49 | | aarch64 | Python3.12 | [link](https://download-r2.pytorch.org/whl/cpu/torch-2.12.0%2Bcpu-cp312-cp312-manylinux_2_28_aarch64.whl) | |
| 50 | 50 | ||
| 51 | -3. **Install torch-npu** | 51 | +3. **Install TorchNPU** |
| 52 | 52 | ||
| 53 | ```bash | 53 | ```bash |
| 54 | pip3 install torch-npu==2.12.0rc1 | 54 | pip3 install torch-npu==2.12.0rc1 |
| @@ -56,9 +56,9 @@ Provide users with wheel package to quickly install **torch_npu**. Before instal | |||
| 56 | 56 | ||
| 57 | ### From Source | 57 | ### From Source |
| 58 | 58 | ||
| 59 | -In some special scenarios, users may need to compile **torch-npu** by themselves.Select a branch in table [Ascend Auxiliary Software](#ascend-auxiliary-software) and a Python version in table [PyTorch and Python Version Matching Table](#pytorch-and-python-version-matching-table) first. The docker image is recommended for compiling torch-npu through the following steps(It is recommended to mount the working path only and avoid the system path to reduce security risks.), the generated .whl file path is ./dist/. Note that gcc version has the following constraints if you try to compile without using docker image: we recommend to use gcc 13.3 for both ARM and X86. | 59 | +In some special scenarios, users may need to compile **TorchNPU** by themselves.Select a branch in table [Ascend Auxiliary Software](#ascend-auxiliary-software) and a Python version in table [PyTorch and Python Version Matching Table](#pytorch-and-python-version-matching-table) first. The docker image is recommended for compiling TorchNPU through the following steps(It is recommended to mount the working path only and avoid the system path to reduce security risks.), the generated .whl file path is ./dist/. Note that gcc version has the following constraints if you try to compile without using docker image: we recommend to use gcc 13.3 for both ARM and X86. |
| 60 | 60 | ||
| 61 | -1. **Clone torch-npu** | 61 | +1. **Clone TorchNPU** |
| 62 | 62 | ||
| 63 | ```bash | 63 | ```bash |
| 64 | git clone https://gitcode.com/ascend/pytorch.git -b v2.12.0 --depth 1 | 64 | git clone https://gitcode.com/ascend/pytorch.git -b v2.12.0 --depth 1 |
| @@ -78,7 +78,7 @@ In some special scenarios, users may need to compile **torch-npu** by themselves | |||
| 78 | # {code_path} is the torch_npu source code path | 78 | # {code_path} is the torch_npu source code path |
| 79 | ``` | 79 | ``` |
| 80 | 80 | ||
| 81 | -4. **Compile torch-npu** | 81 | +4. **Compile TorchNPU** |
| 82 | 82 | ||
| 83 | Take **Python 3.10** as an example. | 83 | Take **Python 3.10** as an example. |
| 84 | 84 | ||
| @@ -135,7 +135,7 @@ print(z) | |||
| 135 | 135 | ||
| 136 | ## User Manual | 136 | ## User Manual |
| 137 | 137 | ||
| 138 | -Refer to [API of Ascend Extension for PyTorch](docs/api/torch_npu_apis.md) for more detailed information. | 138 | +Refer to [API of TorchNPU](docs/api/torch_npu_apis.md) for more detailed information. |
| 139 | 139 | ||
| 140 | ## PyTorch and Python Version Matching Table | 140 | ## PyTorch and Python Version Matching Table |
| 141 | 141 | ||
| @@ -243,7 +243,7 @@ The Ascend inference device includes the following models, all of which can be u | |||
| 243 | 243 | ||
| 244 | ## Pipeline Status | 244 | ## Pipeline Status |
| 245 | 245 | ||
| 246 | -Due to the asynchronous development mechanism of upstream and downstream, incompatible modifications in upstream may cause some functions of **torch_npu** to be unavailable (only upstream and downstream development branches are involved, excluding stable branches). Therefore, we built a set of daily tasks that make it easy to detect relevant issues in time and fix them within 48 hours (under normal circumstances), providing users with the latest features and stable quality. | 246 | +Due to the asynchronous development mechanism of upstream and downstream, incompatible modifications in upstream may cause some functions of **TorchNPU** to be unavailable (only upstream and downstream development branches are involved, excluding stable branches). Therefore, we built a set of daily tasks that make it easy to detect relevant issues in time and fix them within 48 hours (under normal circumstances), providing users with the latest features and stable quality. |
| 247 | 247 | ||
| 248 | | **OS** | **CANN Version(Docker Image)** | **Upstream Branch** | **Downstream Branch** | **Period** | **Status** | | 248 | | **OS** | **CANN Version(Docker Image)** | **Upstream Branch** | **Downstream Branch** | **Period** | **Status** | |
| 249 | | :---: | :---: | :---: | :---: | :---: | :---: | | 249 | | :---: | :---: | :---: | :---: | :---: | :---: | |
| @@ -287,15 +287,15 @@ The version branches of AscendPyTorch have the following maintenance phases: | |||
| 287 | 287 | ||
| 288 | ## Reference Documents | 288 | ## Reference Documents |
| 289 | 289 | ||
| 290 | -For more detailed information on installation guides, model migration, training/inference tutorials, and API lists, please refer to the [Ascend Extension for PyTorch on the HiAI Community](https://www.hiascend.com/software/ai-frameworks?framework=pytorch). | 290 | +For more detailed information on installation guides, model migration, training/inference tutorials, and API lists, please refer to the [Ascend for PyTorch Community](https://www.hiascend.com/software/ai-frameworks?framework=pytorch). |
| 291 | 291 | ||
| 292 | | Document Name | Document Link | | 292 | | Document Name | Document Link | |
| 293 | |------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| | 293 | |------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| |
| 294 | | Installation Guide | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/configandinstg/instg/docs/zh/installation_guide/installation_description.md) | | 294 | | Installation Guide | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/configandinstg/instg/docs/zh/installation_guide/installation_description.md) | |
| 295 | | Network Model Migration and Training | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/ptmoddevg/trainingmigrguide/PT_LMTMOG_0003.html) | | 295 | | Network Model Migration and Training | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/ptmoddevg/trainingmigrguide/PT_LMTMOG_0003.html) | |
| 296 | | Operator Adaptation | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/ptmoddevg/Frameworkfeatures/docs/zh/framework_feature_guide_pytorch/adaptation_description_opplugin.md) | | 296 | | Operator Adaptation | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/ptmoddevg/Frameworkfeatures/docs/zh/framework_feature_guide_pytorch/adaptation_description_opplugin.md) | |
| 297 | -| Ascend Extension for PyTorch (Custom Interfaces) | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/apiref/apilist/ptaoplist_000002.html) | | 297 | +| TorchNPU (Custom Interfaces) | [link](https://www.hiascend.com/document/detail/zh/Pytorch/730/apiref/apilist/ptaoplist_000002.html) | |
| 298 | 298 | ||
| 299 | ## License | 299 | ## License |
| 300 | 300 | ||
| 301 | -Ascend Extension for PyTorch has a BSD-style license, as found in the [LICENSE](LICENSE) file. | 301 | +TorchNPU has a BSD-style license, as found in the [LICENSE](LICENSE) file. |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Ascend Extension for PyTorch插件 安全声明 | 1 | +# TorchNPU插件 安全声明 |
| 2 | 2 | ||
| 3 | ## 系统安全加固 | 3 | ## 系统安全加固 |
| 4 | 4 | ||
| @@ -8,13 +8,13 @@ | |||
| 8 | 8 | ||
| 9 | ## 运行用户建议 | 9 | ## 运行用户建议 |
| 10 | 10 | ||
| 11 | -出于安全性及权限最小化角度考虑,不建议使用root等管理员类型账户使用torch_npu。 | 11 | +出于安全性及权限最小化角度考虑,不建议使用root等管理员类型账户使用TorchNPU。 |
| 12 | 12 | ||
| 13 | ## 文件权限控制 | 13 | ## 文件权限控制 |
| 14 | 14 | ||
| 15 | 1. 建议用户对训练所需文件、训练过程中保存的文件、用户个人的隐私数据、商业资产等敏感文件做好权限控制等安全措施,例如多用户共享数据集场景下的数据集文件写权限控制、profiler等场景产生数据文件权限控制等,设定的权限建议参见[文件权限参考](#文件权限参考)进行设置。 | 15 | 1. 建议用户对训练所需文件、训练过程中保存的文件、用户个人的隐私数据、商业资产等敏感文件做好权限控制等安全措施,例如多用户共享数据集场景下的数据集文件写权限控制、profiler等场景产生数据文件权限控制等,设定的权限建议参见[文件权限参考](#文件权限参考)进行设置。 |
| 16 | 16 | ||
| 17 | -2. torch_npu中profiler工具会生成性能记录文件,生成的文件权限为640,文件夹权限为750,用户可根据需要自行对生成后的相关文件进行权限控制。 | 17 | +2. TorchNPU中profiler工具会生成性能记录文件,生成的文件权限为640,文件夹权限为750,用户可根据需要自行对生成后的相关文件进行权限控制。 |
| 18 | 18 | ||
| 19 | 3. 用户安装和使用过程需要做好权限控制,建议参见[文件权限参考](#文件权限参考)进行设置。如需要保存安装/卸载日志,可在安装/卸载命令后面加上参数--log `<FILE>`, 注意对`<FILE>`文件及目录做好权限管控。 | 19 | 3. 用户安装和使用过程需要做好权限控制,建议参见[文件权限参考](#文件权限参考)进行设置。如需要保存安装/卸载日志,可在安装/卸载命令后面加上参数--log `<FILE>`, 注意对`<FILE>`文件及目录做好权限管控。 |
| 20 | 20 | ||
| @@ -44,30 +44,30 @@ | |||
| 44 | 44 | ||
| 45 | ## 调试工具声明 | 45 | ## 调试工具声明 |
| 46 | 46 | ||
| 47 | -torch_npu内集成性能分析工具profiler: | 47 | +TorchNPU内集成性能分析工具profiler: |
| 48 | 48 | ||
| 49 | - 集成原因:对标PyTorch原生支持能力,提供NPU PyTorch框架开发性能分析能力,加速性能分析调试过程。 | 49 | - 集成原因:对标PyTorch原生支持能力,提供NPU PyTorch框架开发性能分析能力,加速性能分析调试过程。 |
| 50 | - - 使用场景:默认不采集,如用户需要进行性能分析时,可在模型训练脚本中添加Ascend Extension for PyTorch Profiler接口,执行训练的同时采集性能数据,完成训练后直接输出可视化的性能数据文件。 | 50 | + - 使用场景:默认不采集,如用户需要进行性能分析时,可在模型训练脚本中添加TorchNPU Profiler接口,执行训练的同时采集性能数据,完成训练后直接输出可视化的性能数据文件。 |
| 51 | - 风险提示:使用该功能会在本地生成性能数据,用户需加强对相关性能数据的保护,请在需要模型性能分析时使用,分析完成后及时关闭。Profiler工具具体细节请参考[《PyTorch 性能分析工具介绍》](https://www.hiascend.com/document/detail/zh/Pytorch/730/ptmoddevg/trainingmigrguide/performance_tuning_0014.html)。 | 51 | - 风险提示:使用该功能会在本地生成性能数据,用户需加强对相关性能数据的保护,请在需要模型性能分析时使用,分析完成后及时关闭。Profiler工具具体细节请参考[《PyTorch 性能分析工具介绍》](https://www.hiascend.com/document/detail/zh/Pytorch/730/ptmoddevg/trainingmigrguide/performance_tuning_0014.html)。 |
| 52 | 52 | ||
| 53 | ## 数据安全声明 | 53 | ## 数据安全声明 |
| 54 | 54 | ||
| 55 | 1. PyTorch使用过程中需要加载和保存数据,部分接口使用风险模块pickle,可能存在数据风险,如torch.load、torch.jit.load、torch.distributed.scatter_object_list等接口,可参考[torch.load](https://pytorch.org/docs/main/generated/torch.load.html#torch.load)、[collective-functions](https://pytorch.org/docs/main/distributed.html#collective-functions)了解具体风险。 | 55 | 1. PyTorch使用过程中需要加载和保存数据,部分接口使用风险模块pickle,可能存在数据风险,如torch.load、torch.jit.load、torch.distributed.scatter_object_list等接口,可参考[torch.load](https://pytorch.org/docs/main/generated/torch.load.html#torch.load)、[collective-functions](https://pytorch.org/docs/main/distributed.html#collective-functions)了解具体风险。 |
| 56 | -2. Ascend Extension for PyTorch依赖CANN的基础能力实现AOE性能调优、算子dump、日志记录等功能,用户需要关注上述功能生成文件的权限控制,加强对相关数据的保护。 | 56 | +2. TorchNPU依赖CANN的基础能力实现AOE性能调优、算子dump、日志记录等功能,用户需要关注上述功能生成文件的权限控制,加强对相关数据的保护。 |
| 57 | 57 | ||
| 58 | ## 构建安全声明 | 58 | ## 构建安全声明 |
| 59 | 59 | ||
| 60 | -torch_npu支持源码编译安装,在编译时会下载依赖第三方库并执行构建shell脚本,在编译过程中会产生临时程序文件和编译目录。用户可根据需要自行对源代码目录内的文件进行权限管控降低安全风险。 | 60 | +TorchNPU支持源码编译安装,在编译时会下载依赖第三方库并执行构建shell脚本,在编译过程中会产生临时程序文件和编译目录。用户可根据需要自行对源代码目录内的文件进行权限管控降低安全风险。 |
| 61 | 61 | ||
| 62 | ## 运行安全声明 | 62 | ## 运行安全声明 |
| 63 | 63 | ||
| 64 | 1. 建议用户结合运行环境资源状况编写对应训练脚本。若训练脚本与资源状况不匹配,如数据集加载内存大小超出内存容量限制、训练脚本在本地生成数据超过磁盘空间大小等情况,可能引发错误并导致进程意外退出。 | 64 | 1. 建议用户结合运行环境资源状况编写对应训练脚本。若训练脚本与资源状况不匹配,如数据集加载内存大小超出内存容量限制、训练脚本在本地生成数据超过磁盘空间大小等情况,可能引发错误并导致进程意外退出。 |
| 65 | -2. PyTorch和torch_npu在运行异常时会退出进程并打印报错信息,属于正常现象。建议用户根据报错提示定位具体错误原因,包括设定算子同步执行、查看CANN日志、解析生成的Core Dump文件等方式。 | 65 | +2. PyTorch和TorchNPU在运行异常时会退出进程并打印报错信息,属于正常现象。建议用户根据报错提示定位具体错误原因,包括设定算子同步执行、查看CANN日志、解析生成的Core Dump文件等方式。 |
| 66 | -3. PyTorch和torch_npu的分布式特性仅适用于内部通信。出于性能考虑,这些分布式特性不包含任何授权协议,并且会发送未加密的消息。关于PyTorch分布式特性的详细说明及安全注意事项,可参考[using-distributed-features](https://github.com/pytorch/pytorch/security#using-distributed-features)。 | 66 | +3. PyTorch和TorchNPU的分布式特性仅适用于内部通信。出于性能考虑,这些分布式特性不包含任何授权协议,并且会发送未加密的消息。关于PyTorch分布式特性的详细说明及安全注意事项,可参考[using-distributed-features](https://github.com/pytorch/pytorch/security#using-distributed-features)。 |
| 67 | 67 | ||
| 68 | ## 公网地址声明 | 68 | ## 公网地址声明 |
| 69 | 69 | ||
| 70 | -在torch_npu的配置文件和脚本中存在[公网地址](#公网地址) | 70 | +在TorchNPU的配置文件和脚本中存在[公网地址](#公网地址) |
| 71 | 71 | ||
| 72 | ### 公网地址 | 72 | ### 公网地址 |
| 73 | 73 | ||
| @@ -91,8 +91,8 @@ torch_npu支持源码编译安装,在编译时会下载依赖第三方库并 | |||
| 91 | | 自研 | 不涉及 | .github\workflows\\_build-and-test.yml | https://mirrors.huaweicloud.com/repository/pypi/simple | workflow配置文件,用于配置pip源 | | 91 | | 自研 | 不涉及 | .github\workflows\\_build-and-test.yml | https://mirrors.huaweicloud.com/repository/pypi/simple | workflow配置文件,用于配置pip源 | |
| 92 | | 自研 | 不涉及 | setup.cfg | https://gitcode.com/ascend/pytorch | 用于打包whl的url入参 | | 92 | | 自研 | 不涉及 | setup.cfg | https://gitcode.com/ascend/pytorch | 用于打包whl的url入参 | |
| 93 | | 自研 | 不涉及 | setup.cfg | https://gitcode.com/ascend/pytorch/tags | 用于打包whl的download_url入参 | | 93 | | 自研 | 不涉及 | setup.cfg | https://gitcode.com/ascend/pytorch/tags | 用于打包whl的download_url入参 | |
| 94 | -| 自研 | 不涉及 | third_party\op-plugin\ci\build.sh | https://gitcode.com/ascend/pytorch.git | 编译脚本根据torch_npu仓库地址拉取代码进行编译 | | 94 | +| 自研 | 不涉及 | third_party\op-plugin\ci\build.sh | https://gitcode.com/ascend/pytorch.git | 编译脚本根据TorchNPU仓库地址拉取代码进行编译 | |
| 95 | -| 自研 | 不涉及 | third_party\op-plugin\ci\exec_ut.sh | https://gitcode.com/ascend/pytorch.git | UT脚本根据torch_npu仓库地址拉取代码进行UT测试 | | 95 | +| 自研 | 不涉及 | third_party\op-plugin\ci\exec_ut.sh | https://gitcode.com/ascend/pytorch.git | UT脚本根据TorchNPU仓库地址拉取代码进行UT测试 | |
| 96 | | 开源引入 | https://github.com/pytorch/pytorch/blob/release/2.12/test/nn/test_convolution.py <br> https://github.com/pytorch/pytorch/blob/release/2.12/test/test_mps.py <br> https://github.com/pytorch/pytorch/blob/main/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/legacy_conv2d.pt | 用于test脚本下载相关pt文件 | | 96 | | 开源引入 | https://github.com/pytorch/pytorch/blob/release/2.12/test/nn/test_convolution.py <br> https://github.com/pytorch/pytorch/blob/release/2.12/test/test_mps.py <br> https://github.com/pytorch/pytorch/blob/main/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/legacy_conv2d.pt | 用于test脚本下载相关pt文件 | |
| 97 | | 开源引入 | https://github.com/pytorch/pytorch/blob/release/2.12/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/legacy_serialized.pt | 用于test脚本下载相关pt文件 | | 97 | | 开源引入 | https://github.com/pytorch/pytorch/blob/release/2.12/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/legacy_serialized.pt | 用于test脚本下载相关pt文件 | |
| 98 | | 开源引入 | https://github.com/pytorch/pytorch/blob/release/2.12/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/gpu_tensors.pt | 用于test脚本下载相关pt文件 | | 98 | | 开源引入 | https://github.com/pytorch/pytorch/blob/release/2.12/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/gpu_tensors.pt | 用于test脚本下载相关pt文件 | |
| @@ -106,11 +106,11 @@ torch_npu支持源码编译安装,在编译时会下载依赖第三方库并 | |||
| 106 | 106 | ||
| 107 | ## 公开接口声明 | 107 | ## 公开接口声明 |
| 108 | 108 | ||
| 109 | -Ascend Extension for PyTorch是PyTorch适配插件,支持用户使用PyTorch在昇腾设备上进行训练和推理。Ascend Extension for PyTorch适配后支持用户使用PyTorch原生接口。除了原生PyTorch接口外,Ascend Extension for PyTorch提供了部分自定义接口,包括自定义算子、亲和库和其他接口,支持PyTorch接口和自定义接口连接,具体可参见[《Ascend Extension for PyTorch自定义API参考》](https://www.hiascend.com/document/detail/zh/Pytorch/730/apiref/torchnpuCustomsapi/docs/context/overview.md)以及[《PyTorch原生接口清单》](https://www.hiascend.com/document/detail/zh/Pytorch/730/apiref/PyTorchNativeapi/docs/zh/native_apis/pytorch_2-9-0/overview.md)。 | 109 | +TorchNPU是PyTorch适配插件,支持用户使用PyTorch在昇腾设备上进行训练和推理。TorchNPU适配后支持用户使用PyTorch原生接口。除了原生PyTorch接口外,TorchNPU提供了部分自定义接口,包括自定义算子、亲和库和其他接口,支持PyTorch接口和自定义接口连接,具体可参见[《TorchNPU自定义API参考》](https://www.hiascend.com/document/detail/zh/Pytorch/730/apiref/torchnpuCustomsapi/docs/context/overview.md)以及[《PyTorch原生接口清单》](https://www.hiascend.com/document/detail/zh/Pytorch/730/apiref/PyTorchNativeapi/docs/zh/native_apis/pytorch_2-9-0/overview.md)。 |
| 110 | 110 | ||
| 111 | -参考[PyTorch社区公开接口规范](https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation),Ascend Extension for PyTorch提供了对外的自定义接口。如果一个函数看起来符合公开接口的标准且在文档中有展示,则该接口是公开接口。否则,使用该功能前可以在社区询问该功能是否确实是公开的或意外暴露的接口,因为这些未暴露接口将来可能会被修改或者删除。 | 111 | +参考[PyTorch社区公开接口规范](https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation),TorchNPU提供了对外的自定义接口。如果一个函数看起来符合公开接口的标准且在文档中有展示,则该接口是公开接口。否则,使用该功能前可以在社区询问该功能是否确实是公开的或意外暴露的接口,因为这些未暴露接口将来可能会被修改或者删除。 |
| 112 | 112 | ||
| 113 | -Ascend Extension for PyTorch项目采用C++和Python联合开发,当前除Libtorch场景外正式接口只提供Python接口,在torch_npu的二进制包中动态库不直接提供服务,暴露的接口为内部使用,不建议用户使用。 | 113 | +TorchNPU项目采用C++和Python联合开发,当前除Libtorch场景外正式接口只提供Python接口,在TorchNPU的二进制包中动态库不直接提供服务,暴露的接口为内部使用,不建议用户使用。 |
| 114 | 114 | ||
| 115 | ## 通信安全加固 | 115 | ## 通信安全加固 |
| 116 | 116 | ||
| @@ -210,7 +210,7 @@ PyTorch分布式训练服务需要在设备间进行通信,通信开启的端 | |||
| 210 | 210 | ||
| 211 | ## 通信矩阵 | 211 | ## 通信矩阵 |
| 212 | 212 | ||
| 213 | -PyTorch提供分布式训练能力,支持在单机和多机场景下进行训练,需要进行网络通信。其中PyTorch需要使用TCP进行通信,torch_npu使用CANN中HCCL在NPU设备间通信,通信端口见[通信矩阵信息](#通信矩阵信息)。用户需要注意并保障节点间通信网络安全,可以使用iptables等方式消减安全风险,可参考[通信安全加固](#通信安全加固)进行网络安全加固。 | 213 | +PyTorch提供分布式训练能力,支持在单机和多机场景下进行训练,需要进行网络通信。其中PyTorch需要使用TCP进行通信,TorchNPU使用CANN中HCCL在NPU设备间通信,通信端口见[通信矩阵信息](#通信矩阵信息)。用户需要注意并保障节点间通信网络安全,可以使用iptables等方式消减安全风险,可参考[通信安全加固](#通信安全加固)进行网络安全加固。 |
| 214 | 214 | ||
| 215 | ### 通信矩阵信息 | 215 | ### 通信矩阵信息 |
| 216 | 216 | ||
| @@ -230,15 +230,15 @@ PyTorch提供分布式训练能力,支持在单机和多机场景下进行训 | |||
| 230 | | 所属平面 | 不涉及 | 不涉及 | | 230 | | 所属平面 | 不涉及 | 不涉及 | |
| 231 | | 版本 | 所有版本 | 所有版本 | | 231 | | 版本 | 所有版本 | 所有版本 | |
| 232 | | 特殊场景 | 无 | 无 | | 232 | | 特殊场景 | 无 | 无 | |
| 233 | -| 备注 | 该通信过程由开源软件PyTorch控制,配置为PyTorch原生设置,可参考[PyTorch文档](https://pytorch.org/docs/stable/distributed.html#launch-utility)。源端口由操作系统自动分配,分配范围由操作系统的配置决定,例如ubuntu:采用/proc/sys/net/ipv4/ipv4_local_port_range文件指定,可通过cat /proc/sys/net/ipv4/ipv4_local_port_range或sysctl net.ipv4.ip_local_port_range查看 | 该通信过程由CANN中HCCL组件控制,torch_npu不进行控制,端口范围可参考[《环境变量参考》](https://www.hiascend.com/document/detail/zh/canncommercial/850/maintenref/envvar/envref_07_0001.html)的“执行相关 > 集合通信 >HCCL_IF_BASE_PORT” | | 233 | +| 备注 | 该通信过程由开源软件PyTorch控制,配置为PyTorch原生设置,可参考[PyTorch文档](https://pytorch.org/docs/stable/distributed.html#launch-utility)。源端口由操作系统自动分配,分配范围由操作系统的配置决定,例如ubuntu:采用/proc/sys/net/ipv4/ipv4_local_port_range文件指定,可通过cat /proc/sys/net/ipv4/ipv4_local_port_range或sysctl net.ipv4.ip_local_port_range查看 | 该通信过程由CANN中HCCL组件控制,TorchNPU不进行控制,端口范围可参考[《环境变量参考》](https://www.hiascend.com/document/detail/zh/canncommercial/850/maintenref/envvar/envref_07_0001.html)的“执行相关 > 集合通信 >HCCL_IF_BASE_PORT” | |
| 234 | 234 | ||
| 235 | ## 漏洞机制说明 | 235 | ## 漏洞机制说明 |
| 236 | 236 | ||
| 237 | -Ascend Extension for PyTorch 社区非常重视社区版本的安全性,专门设置了漏洞管理专员负责处理漏洞相关的事务,同时为了构建更安全的AI全流程工具链,我们也欢迎您一起参与。 | 237 | +Ascend for PyTorch 社区非常重视社区版本的安全性,专门设置了漏洞管理专员负责处理漏洞相关的事务,同时为了构建更安全的AI全流程工具链,我们也欢迎您一起参与。 |
| 238 | 238 | ||
| 239 | ### 漏洞处理流程 | 239 | ### 漏洞处理流程 |
| 240 | 240 | ||
| 241 | -对于每一个安全漏洞,Ascend Extension for PyTorch 社区会安排人员进行跟踪和处理,漏洞处理的端到端流程如下图所示。 | 241 | +对于每一个安全漏洞,Ascend for PyTorch 社区会安排人员进行跟踪和处理,漏洞处理的端到端流程如下图所示。 |
| 242 | 242 | ||
| 243 |  | 243 |  |
| 244 | 244 | ||
| @@ -246,22 +246,22 @@ Ascend Extension for PyTorch 社区非常重视社区版本的安全性,专门 | |||
| 246 | 246 | ||
| 247 | ### 漏洞上报 | 247 | ### 漏洞上报 |
| 248 | 248 | ||
| 249 | -您可以通过提交issue的方式联系 Ascend Extension for PyTorch 社区团队,我们将会第一时间安排安全漏洞专项人员向您联系。 | 249 | +您可以通过提交issue的方式联系 Ascend for PyTorch 社区团队,我们将会第一时间安排安全漏洞专项人员向您联系。 |
| 250 | 注意,为了确保安全性,请不要在issue中描述涉及安全隐私的具体信息。 | 250 | 注意,为了确保安全性,请不要在issue中描述涉及安全隐私的具体信息。 |
| 251 | 251 | ||
| 252 | #### 上报响应 | 252 | #### 上报响应 |
| 253 | 253 | ||
| 254 | -1. Ascend Extension for PyTorch 社区会在3个工作日内确认、分析、上报安全漏洞问题,同时启动安全处理流程。 | 254 | +1. Ascend for PyTorch 社区会在3个工作日内确认、分析、上报安全漏洞问题,同时启动安全处理流程。 |
| 255 | -2. Ascend Extension for PyTorch 安全团队在确认安全漏洞问题后,会对问题进行分发和跟进。 | 255 | +2. TorchNPU 安全团队在确认安全漏洞问题后,会对问题进行分发和跟进。 |
| 256 | 3. 在安全漏洞问题从分类、确定、修复和发布的过程中,我们会及时更新报告。 | 256 | 3. 在安全漏洞问题从分类、确定、修复和发布的过程中,我们会及时更新报告。 |
| 257 | 257 | ||
| 258 | ### 漏洞评估 | 258 | ### 漏洞评估 |
| 259 | 259 | ||
| 260 | -业界普遍使用 CVSS 标准评估漏洞的严重性,Ascend Extension for PyTorch 在使用 CVSS v3.1 进行漏洞评估时,需要设定漏洞攻击场景,基于在该攻击场景下的实际影响进行评估。漏洞严重等级评估是指针对漏洞利用难易程度,以及利用后对机密性、完整性、可用性的影响进行评估,并生成一个评分值。 | 260 | +业界普遍使用 CVSS 标准评估漏洞的严重性,TorchNPU 在使用 CVSS v3.1 进行漏洞评估时,需要设定漏洞攻击场景,基于在该攻击场景下的实际影响进行评估。漏洞严重等级评估是指针对漏洞利用难易程度,以及利用后对机密性、完整性、可用性的影响进行评估,并生成一个评分值。 |
| 261 | 261 | ||
| 262 | #### 漏洞评估标准 | 262 | #### 漏洞评估标准 |
| 263 | 263 | ||
| 264 | -Ascend Extension for PyTorch 通过以下向量评估一个漏洞的严重等级: | 264 | +TorchNPU 通过以下向量评估一个漏洞的严重等级: |
| 265 | 265 | ||
| 266 | - 攻击向量(AV):表示攻击的“远程性”以及如何利用此漏洞。 | 266 | - 攻击向量(AV):表示攻击的“远程性”以及如何利用此漏洞。 |
| 267 | - 攻击复杂性(AC):讲述攻击执行的难度以及成功进行攻击需要哪些因素。 | 267 | - 攻击复杂性(AC):讲述攻击执行的难度以及成功进行攻击需要哪些因素。 |
| @@ -304,8 +304,8 @@ Ascend Extension for PyTorch 通过以下向量评估一个漏洞的严重等级 | |||
| 304 | 304 | ||
| 305 | ### 漏洞披露 | 305 | ### 漏洞披露 |
| 306 | 306 | ||
| 307 | -安全漏洞修复后 Ascend Extension for PyTorch 社区会发布安全公告 (SA)以及安全说明(SN) ,安全公告内容包括该漏洞的技术细节、类型、上报人、CVE ID 以及受到该漏洞影响的版本和修复版本等信息。 | 307 | +安全漏洞修复后 Ascend for PyTorch 社区会发布安全公告 (SA)以及安全说明(SN) ,安全公告内容包括该漏洞的技术细节、类型、上报人、CVE ID 以及受到该漏洞影响的版本和修复版本等信息。 |
| 308 | -为了保护 Ascend Extension for PyTorch 用户的安全,在进行调查、修复和发布安全公告之前, Ascend Extension for PyTorch 社区不会公开披露、讨论或确认 Ascend Extension for PyTorch 产品的安全问题。 | 308 | +为了保护 TorchNPU 用户的安全,在进行调查、修复和发布安全公告之前, Ascend for PyTorch 社区不会公开披露、讨论或确认 TorchNPU 产品的安全问题。 |
| 309 | 309 | ||
| 310 | ### 附录 | 310 | ### 附录 |
| 311 | 311 | ||
| @@ -2,9 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | This folder hosts the `Dockerfile` to build docker images with various platforms. | 3 | This folder hosts the `Dockerfile` to build docker images with various platforms. |
| 4 | 4 | ||
| 5 | -## Build torch_npu from Docker container | 5 | +## Build TorchNPU from Docker container |
| 6 | 6 | ||
| 7 | -**Clone torch-npu** | 7 | +**Clone TorchNPU** |
| 8 | 8 | ||
| 9 | ```Shell | 9 | ```Shell |
| 10 | git clone https://gitcode.com/ascend/pytorch.git --depth 1 | 10 | git clone https://gitcode.com/ascend/pytorch.git --depth 1 |
| @@ -31,7 +31,7 @@ docker run -it -v /{code_path}/pytorch:/home/pytorch manylinux-builder:v1 bash | |||
| 31 | # {code_path} is the torch_npu source code path | 31 | # {code_path} is the torch_npu source code path |
| 32 | ``` | 32 | ``` |
| 33 | 33 | ||
| 34 | -**Compile torch_npu** | 34 | +**Compile TorchNPU** |
| 35 | 35 | ||
| 36 | Take Python 3.10 as an example | 36 | Take Python 3.10 as an example |
| 37 | 37 | ||
| @@ -2,9 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | ## 环境约束 | 3 | ## 环境约束 |
| 4 | 4 | ||
| 5 | -1)**torch_npu 和 CANN 环境** | 5 | +1)**TorchNPU 和 CANN 环境** |
| 6 | 6 | ||
| 7 | -本样例依赖 torch_npu 运行环境,推荐 torch_npu 26.1.0 及配套 CANN 9.1.0 版本。 | 7 | +本样例依赖 TorchNPU 运行环境,推荐 TorchNPU 26.1.0 及配套 CANN 9.1.0 版本。 |
| 8 | 8 | ||
| 9 | 2)**triton-ascend >= 3.2.2** | 9 | 2)**triton-ascend >= 3.2.2** |
| 10 | 10 | ||
| @@ -1,29 +1,38 @@ | |||
| 1 | -## 简介 | 1 | +# 简介 |
| 2 | -test目录为PTA相关的测试用例。 | 2 | + |
| 3 | +test目录为TorchNPU相关的测试用例。 | ||
| 4 | + | ||
| 3 | ## 安装依赖 | 5 | ## 安装依赖 |
| 4 | 6 | ||
| 5 | `pip3 install -r requirements.txt` | 7 | `pip3 install -r requirements.txt` |
| 6 | 8 | ||
| 7 | ## 补全脚本 | 9 | ## 补全脚本 |
| 10 | + | ||
| 8 | 该操作需要联网 | 11 | 该操作需要联网 |
| 9 | -``` | 12 | + |
| 13 | +```bash | ||
| 10 | cd test | 14 | cd test |
| 11 | bash get_synchronized_files.sh | 15 | bash get_synchronized_files.sh |
| 12 | ``` | 16 | ``` |
| 17 | + | ||
| 13 | 通过以上操作,会自动补齐testfiles_synchronized.txt和testfolder_synchronized.txt中的文件或文件夹。 | 18 | 通过以上操作,会自动补齐testfiles_synchronized.txt和testfolder_synchronized.txt中的文件或文件夹。 |
| 19 | + | ||
| 14 | ## 跳过失败用例 | 20 | ## 跳过失败用例 |
| 21 | + | ||
| 15 | `export DISABLED_TESTS_FILE=./unsupported_test_cases/.pytorch-disabled-tests.json` | 22 | `export DISABLED_TESTS_FILE=./unsupported_test_cases/.pytorch-disabled-tests.json` |
| 16 | 23 | ||
| 17 | 如果不是在test目录下运行测试用例,需要传入.pytorch-disabled-tests.json的绝对路径。 | 24 | 如果不是在test目录下运行测试用例,需要传入.pytorch-disabled-tests.json的绝对路径。 |
| 25 | + | ||
| 18 | ## 执行方式 | 26 | ## 执行方式 |
| 27 | + | ||
| 19 | ### 执行单个测试脚本 | 28 | ### 执行单个测试脚本 |
| 29 | + | ||
| 20 | 运行以test开头的文件。以test_autocast.py为例: | 30 | 运行以test开头的文件。以test_autocast.py为例: |
| 21 | 31 | ||
| 22 | 方式一: | 32 | 方式一: |
| 23 | 33 | ||
| 24 | `python test_autocast.py` | 34 | `python test_autocast.py` |
| 25 | 35 | ||
| 26 | - | ||
| 27 | 方式二: | 36 | 方式二: |
| 28 | 37 | ||
| 29 | `python run_test.py -i test_autocast` | 38 | `python run_test.py -i test_autocast` |
| @@ -31,6 +40,7 @@ bash get_synchronized_files.sh | |||
| 31 | 说明:部分以test开头的脚本不是直接运行的脚本,比如jit中的测试脚本是通过test_jit.py执行的。 | 40 | 说明:部分以test开头的脚本不是直接运行的脚本,比如jit中的测试脚本是通过test_jit.py执行的。 |
| 32 | 41 | ||
| 33 | ### 执行具体的用例 | 42 | ### 执行具体的用例 |
| 43 | + | ||
| 34 | 通过-k参数传入具体的用例名。以test_autocast.py为例: | 44 | 通过-k参数传入具体的用例名。以test_autocast.py为例: |
| 35 | 45 | ||
| 36 | 方式一: | 46 | 方式一: |
| @@ -42,24 +52,26 @@ bash get_synchronized_files.sh | |||
| 42 | `python run_test.py -v -i test_autocast -- -k test_autocast_nn_fp32` | 52 | `python run_test.py -v -i test_autocast -- -k test_autocast_nn_fp32` |
| 43 | 53 | ||
| 44 | ### 执行全量UT的方式 | 54 | ### 执行全量UT的方式 |
| 45 | -``` | 55 | + |
| 56 | +```bash | ||
| 46 | # 进入到test目录的上一级 | 57 | # 进入到test目录的上一级 |
| 47 | cd ../ | 58 | cd ../ |
| 48 | ``` | 59 | ``` |
| 49 | 60 | ||
| 50 | 运行非分布式全量用例: | 61 | 运行非分布式全量用例: |
| 51 | 62 | ||
| 52 | -``` | 63 | +```bash |
| 53 | python ci/access_control_test.py --all | 64 | python ci/access_control_test.py --all |
| 54 | ``` | 65 | ``` |
| 55 | 66 | ||
| 56 | 运行分布式全量用例: | 67 | 运行分布式全量用例: |
| 57 | 68 | ||
| 58 | -``` | 69 | +```bash |
| 59 | python ci/access_control_test.py --distributed | 70 | python ci/access_control_test.py --distributed |
| 60 | ``` | 71 | ``` |
| 61 | 72 | ||
| 62 | ## FAQ | 73 | ## FAQ |
| 74 | + | ||
| 63 | 1. 报错:"dictionary changed size during interation". | 75 | 1. 报错:"dictionary changed size during interation". |
| 64 | 76 | ||
| 65 | 如果python 环境是3.8.1版本,报错在unitest/case.py中,可考虑是sys.modules被修改导致的。第三方包可能会有对sys.modules的修改,比如beartype。 | 77 | 如果python 环境是3.8.1版本,报错在unitest/case.py中,可考虑是sys.modules被修改导致的。第三方包可能会有对sys.modules的修改,比如beartype。 |
| @@ -1,41 +1,50 @@ | |||
| 1 | # 简介 | 1 | # 简介 |
| 2 | + | ||
| 2 | Torch 的 Inductor-MLIR 编译优化是基于 torch.compile 接口、融合 MLIR(Multi-Level Intermediate Representation)技术的新一代后端优化方案。Inductor-MLIR 是 PyTorch 编译体系对原生 Inductor 后端的扩展升级,在保留 torch.compile 动态图捕获 + 静态图优化 + 高效代码生成的核心逻辑的基础上,借助 MLIR 的多层级、跨架构编译能力,适配多类硬件架构的深度优化需求,显著提升不同算力平台下模型训练与推理的编译灵活性和性能上限。 | 3 | Torch 的 Inductor-MLIR 编译优化是基于 torch.compile 接口、融合 MLIR(Multi-Level Intermediate Representation)技术的新一代后端优化方案。Inductor-MLIR 是 PyTorch 编译体系对原生 Inductor 后端的扩展升级,在保留 torch.compile 动态图捕获 + 静态图优化 + 高效代码生成的核心逻辑的基础上,借助 MLIR 的多层级、跨架构编译能力,适配多类硬件架构的深度优化需求,显著提升不同算力平台下模型训练与推理的编译灵活性和性能上限。 |
| 4 | + | ||
| 3 | Inductor-MLIR 包含如下核心组件: | 5 | Inductor-MLIR 包含如下核心组件: |
| 4 | -|组件| 定位 |作用| | 6 | + |
| 5 | -|-|-|-| | 7 | +| 组件 | 定位 | 作用 | |
| 6 | -|Dynamo |前端编译器(代码转换器) |延续 TorchDynamo 的核心能力,JIT 将用户的 eager(动态图)代码编译为 FX Graph,完成动态图到静态中间表示的捕获,为 Inductor-MLIR 后端提供统一的输入,保证前端编译逻辑的一致性| | 8 | +| --- | --- | --- | |
| 7 | -|Inductor-MLIR |核心编译器(多层级 IR 优化器) |作为 Inductor-MLIR 的核心层,将 FX Graph 转换为 MLIR 多层级中间表示(IR);通过跨层级的优化策略(如算子拆分与融合、数据类型优化、计算图化简),兼顾编译灵活性与优化深度,适配不同硬件的编译特性| | 9 | +| Dynamo | 前端编译器(代码转换器) | 延续 TorchDynamo 的核心能力,JIT 将用户的 eager(动态图)代码编译为 FX Graph,完成动态图到静态中间表示的捕获,为 Inductor-MLIR 后端提供统一的输入,保证前端编译逻辑的一致性 | |
| 8 | -|MLIR CodeGen |代码生成器(硬件感知代码生成器) |接收优化后的 MLIR IR,针对目标硬件生成专属的高性能底层代码| | 10 | +| Inductor-MLIR | 核心编译器(多层级 IR 优化器) | 作为 Inductor-MLIR 的核心层,将 FX Graph 转换为 MLIR 多层级中间表示(IR);通过跨层级的优化策略(如算子拆分与融合、数据类型优化、计算图化简),兼顾编译灵活性与优化深度,适配不同硬件的编译特性 | |
| 11 | +| MLIR CodeGen | 代码生成器(硬件感知代码生成器) | 接收优化后的 MLIR IR,针对目标硬件生成专属的高性能底层代码 | | ||
| 9 | 12 | ||
| 10 | # 使用指导 | 13 | # 使用指导 |
| 14 | + | ||
| 11 | ## 环境配置 | 15 | ## 环境配置 |
| 12 | 16 | ||
| 13 | -* torch_npu:2.6.0或之后版本的torch_npu支持torch.compile接口; | 17 | +* TorchNPU:2.6.0或之后版本的TorchNPU支持torch.compile接口; |
| 14 | * torch-mlir:Inductor后端的MLIR模式依赖torch-mlir。用户可以从[LINK](https://repo.oepkgs.net/ascend/pytorch/vllm/torch/)获取torch-mlir软件包; | 18 | * torch-mlir:Inductor后端的MLIR模式依赖torch-mlir。用户可以从[LINK](https://repo.oepkgs.net/ascend/pytorch/vllm/torch/)获取torch-mlir软件包; |
| 15 | 19 | ||
| 16 | ## 使用方式 | 20 | ## 使用方式 |
| 21 | + | ||
| 17 | MLIR使用方式有三种, 任选一种即可调用 | 22 | MLIR使用方式有三种, 任选一种即可调用 |
| 18 | 23 | ||
| 19 | 1. config导入(torch.compile之前导入) | 24 | 1. config导入(torch.compile之前导入) |
| 20 | -``` | 25 | + |
| 21 | -torch._inductor.config.npu_backend == "mlir" | 26 | + ```python |
| 22 | -torch.compile(op_calc)(x) | 27 | + torch._inductor.config.npu_backend == "mlir" |
| 23 | -``` | 28 | + torch.compile(op_calc)(x) |
| 29 | + ``` | ||
| 24 | 30 | ||
| 25 | 2. 环境变量导入(npu初始化之前导入) | 31 | 2. 环境变量导入(npu初始化之前导入) |
| 26 | 32 | ||
| 27 | -``` | 33 | + ```python |
| 28 | -import os | 34 | + import os |
| 29 | -os.environ['TORCHINDUCTOR_NPU_BACKEND'] = 'mlir' | 35 | + os.environ['TORCHINDUCTOR_NPU_BACKEND'] = 'mlir' |
| 30 | -torch.compile(op_calc)(x) | 36 | + torch.compile(op_calc)(x) |
| 31 | -``` | 37 | + ``` |
| 38 | + | ||
| 32 | 3. options导入 | 39 | 3. options导入 |
| 33 | -``` | 40 | + |
| 34 | -torch.compile(op_calc,options={"npu_backend":"mlir"})(x) | 41 | + ```python |
| 35 | -``` | 42 | + torch.compile(op_calc,options={"npu_backend":"mlir"})(x) |
| 43 | + ``` | ||
| 44 | + | ||
| 36 | ## 示例 | 45 | ## 示例 |
| 37 | 46 | ||
| 38 | -``` | 47 | +```python |
| 39 | import os | 48 | import os |
| 40 | # 环境变量调用需要在torch_npu初始化之前 | 49 | # 环境变量调用需要在torch_npu初始化之前 |
| 41 | os.environ['TORCHINDUCTOR_NPU_BACKEND'] = 'mlir' | 50 | os.environ['TORCHINDUCTOR_NPU_BACKEND'] = 'mlir' |
| @@ -62,9 +71,12 @@ compile_func = torch.compile(op_calc, options={"npu_backend": "mlir"}) | |||
| 62 | compile_out, codes = run_and_get_code(compile_func,x,y) | 71 | compile_out, codes = run_and_get_code(compile_func,x,y) |
| 63 | print(codes[0]) | 72 | print(codes[0]) |
| 64 | ``` | 73 | ``` |
| 74 | + | ||
| 65 | ## 输出mlir融合算子 | 75 | ## 输出mlir融合算子 |
| 76 | + | ||
| 66 | codes 为捕获到的 MLIR 输出代码片段,该代码中包含 call 函数与 benchmark_compiled_model 函数,其中 call 函数内部封装了 MLIR 编译生成的算子逻辑。 | 77 | codes 为捕获到的 MLIR 输出代码片段,该代码中包含 call 函数与 benchmark_compiled_model 函数,其中 call 函数内部封装了 MLIR 编译生成的算子逻辑。 |
| 67 | -``` | 78 | + |
| 79 | +```python | ||
| 68 | def call(args): | 80 | def call(args): |
| 69 | arg0_1, arg1_1 = args | 81 | arg0_1, arg1_1 = args |
| 70 | args.clear() | 82 | args.clear() |
| @@ -77,4 +89,5 @@ def call(args): | |||
| 77 | del arg1_1 | 89 | del arg1_1 |
| 78 | return (buf0, ) | 90 | return (buf0, ) |
| 79 | ``` | 91 | ``` |
| 80 | -其中mlir_fused_mul_0.run 是 MLIR 编译生成的核心执行接口,用于在指定 NPU 设备和计算流上执行融合乘法算子计算,接收输入张量并将计算结果写入输出张量,是 MLIR 对原始乘法逻辑优化后的底层实现。 | 92 | + |
| 93 | +其中mlir_fused_mul_0.run 是 MLIR 编译生成的核心执行接口,用于在指定 NPU 设备和计算流上执行融合乘法算子计算,接收输入张量并将计算结果写入输出张量,是 MLIR 对原始乘法逻辑优化后的底层实现。 | ||