Unverified Commit 37aa6dd0 authored by wangjiangben-hw's avatar wangjiangben-hw Committed by GitHub
Browse files

[Docs] Replace NPU with Ascend in installation documentation (#2469)



* update NPU --> ASCEND

* update docs

* update

* update docs

* Update docs/en/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/zh_cn/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/zh_cn/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/zh_cn/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/zh_cn/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/en/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/en/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/en/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update docs/en/get_started/build.md

* Update docs/zh_cn/get_started/build.md
Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>
parent c69d5c4c
...@@ -327,3 +327,51 @@ Firstly, you need to apply for an IPU cloud machine, see [here](https://www.grap ...@@ -327,3 +327,51 @@ Firstly, you need to apply for an IPU cloud machine, see [here](https://www.grap
1. Build MMCV 1. Build MMCV
2. Use pip to install sdk according to [IPU PyTorch document](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/installation.html). Also, you need to apply for machine and sdk to Graphcore. 2. Use pip to install sdk according to [IPU PyTorch document](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/installation.html). Also, you need to apply for machine and sdk to Graphcore.
### Build mmcv-full on Ascend NPU machine
Before building mmcv-full, `torch_npu` should be installed. See the complete installation tutorial [PyTorch Installation Guide](https://gitee.com/ascend/pytorch/blob/master/docs/en/PyTorch%20Installation%20Guide/PyTorch%20Installation%20Guide.md)
#### Option 1: Install mmcv-full with pip
The Ascend compiled version of mmcv-full is already supported when the version of mmcv >= 1.7.0, we can pip install directly
```bash
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/ascend/torch1.8.0/index.html
```
#### Option 2: Build mmcv-full NPU (Ascend) from Source
- Pull the source code
```bash
git pull https://github.com/open-mmlab/mmcv/tree/master
```
- Build
```bash
MMCV_WITH_OPS=1 MAX_JOBS=8 FORCE_NPU=1 python setup.py build_ext
```
- Install
```bash
MMCV_WITH_OPS=1 FORCE_NPU=1 python setup.py develop
```
#### Test Case
```python
import torch
import torch_npu
from mmcv.ops import softmax_focal_loss
# Init tensor to the NPU
x = torch.randn(3, 10).npu()
y = torch.tensor([1, 5, 3]).npu()
w = torch.ones(10).float().npu()
output = softmax_focal_loss(x, y, 2.0, 0.25, w, 'none')
print(output)
```
...@@ -2,61 +2,61 @@ ...@@ -2,61 +2,61 @@
We implement common ops used in detection, segmentation, etc. We implement common ops used in detection, segmentation, etc.
| Device | CPU | CUDA | MLU | MPS | NPU | | Device | CPU | CUDA | MLU | MPS | Ascend |
| ---------------------------- | --- | ---- | --- | --- | --- | | ---------------------------- | --- | ---- | --- | --- | ------ |
| ActiveRotatedFilter | √ | √ | | | | | ActiveRotatedFilter | √ | √ | | | |
| AssignScoreWithK | | √ | | | | | AssignScoreWithK | | √ | | | |
| BallQuery | | √ | | | | | BallQuery | | √ | | | |
| BBoxOverlaps | | √ | √ | √ | | | BBoxOverlaps | | √ | √ | √ | |
| BorderAlign | | √ | | | | | BorderAlign | | √ | | | |
| BoxIouRotated | √ | √ | | | | | BoxIouRotated | √ | √ | | | |
| BoxIouQuadri | √ | √ | | | | | BoxIouQuadri | √ | √ | | | |
| CARAFE | | √ | √ | | | | CARAFE | | √ | √ | | |
| ChamferDistance | | √ | | | | | ChamferDistance | | √ | | | |
| CrissCrossAttention | | √ | | | | | CrissCrossAttention | | √ | | | |
| ContourExpand | √ | | | | | | ContourExpand | √ | | | | |
| ConvexIoU | | √ | | | | | ConvexIoU | | √ | | | |
| CornerPool | | √ | | | | | CornerPool | | √ | | | |
| Correlation | | √ | | | | | Correlation | | √ | | | |
| Deformable Convolution v1/v2 | √ | √ | | | | | Deformable Convolution v1/v2 | √ | √ | | | |
| Deformable RoIPool | | √ | √ | | | | Deformable RoIPool | | √ | √ | | |
| DiffIoURotated | | √ | | | | | DiffIoURotated | | √ | | | |
| DynamicScatter | | √ | | | | | DynamicScatter | | √ | | | |
| FurthestPointSample | | √ | | | | | FurthestPointSample | | √ | | | |
| FurthestPointSampleWithDist | | √ | | | | | FurthestPointSampleWithDist | | √ | | | |
| FusedBiasLeakyrelu | | √ | | | | | FusedBiasLeakyrelu | | √ | | | |
| GatherPoints | | √ | | | | | GatherPoints | | √ | | | |
| GroupPoints | | √ | | | | | GroupPoints | | √ | | | |
| Iou3d | | √ | √ | | | | Iou3d | | √ | √ | | |
| KNN | | √ | | | | | KNN | | √ | | | |
| MaskedConv | | √ | √ | | √ | | MaskedConv | | √ | √ | | √ |
| MergeCells | | √ | | | | | MergeCells | | √ | | | |
| MinAreaPolygon | | √ | | | | | MinAreaPolygon | | √ | | | |
| ModulatedDeformConv2d | √ | √ | √ | | √ | | ModulatedDeformConv2d | √ | √ | √ | | √ |
| MultiScaleDeformableAttn | | √ | √ | | | | MultiScaleDeformableAttn | | √ | √ | | |
| NMS | √ | √ | √ | | √ | | NMS | √ | √ | √ | | √ |
| NMSRotated | √ | √ | | | | | NMSRotated | √ | √ | | | |
| NMSQuadri | √ | √ | | | | | NMSQuadri | √ | √ | | | |
| PixelGroup | √ | | | | | | PixelGroup | √ | | | | |
| PointsInBoxes | √ | √ | | | | | PointsInBoxes | √ | √ | | | |
| PointsInPolygons | | √ | | | | | PointsInPolygons | | √ | | | |
| PSAMask | √ | √ | √ | | | | PSAMask | √ | √ | √ | | |
| RotatedFeatureAlign | √ | √ | | | | | RotatedFeatureAlign | √ | √ | | | |
| RoIPointPool3d | | √ | √ | | | | RoIPointPool3d | | √ | √ | | |
| RoIPool | | √ | √ | | | | RoIPool | | √ | √ | | |
| RoIAlignRotated | √ | √ | √ | | | | RoIAlignRotated | √ | √ | √ | | |
| RiRoIAlignRotated | | √ | | | | | RiRoIAlignRotated | | √ | | | |
| RoIAlign | √ | √ | √ | | | | RoIAlign | √ | √ | √ | | |
| RoIAwarePool3d | | √ | √ | | | | RoIAwarePool3d | | √ | √ | | |
| SAConv2d | | √ | | | | | SAConv2d | | √ | | | |
| SigmoidFocalLoss | | √ | √ | | √ | | SigmoidFocalLoss | | √ | √ | | √ |
| SoftmaxFocalLoss | | √ | | | √ | | SoftmaxFocalLoss | | √ | | | √ |
| SoftNMS | | √ | | | | | SoftNMS | | √ | | | |
| Sparse Convolution | | √ | | | | | Sparse Convolution | | √ | | | |
| Synchronized BatchNorm | | √ | | | | | Synchronized BatchNorm | | √ | | | |
| ThreeInterpolate | | √ | | | | | ThreeInterpolate | | √ | | | |
| ThreeNN | | √ | √ | | | | ThreeNN | | √ | √ | | |
| TINShift | | √ | √ | | | | TINShift | | √ | √ | | |
| UpFirDn2d | | √ | | | | | UpFirDn2d | | √ | | | |
| Voxelization | √ | √ | | | | | Voxelization | √ | √ | | | |
| PrRoIPool | | √ | | | | | PrRoIPool | | √ | | | |
...@@ -344,41 +344,48 @@ mmcv-full 有两个版本: ...@@ -344,41 +344,48 @@ mmcv-full 有两个版本:
### 在昇腾 NPU 机器编译 mmcv-full ### 在昇腾 NPU 机器编译 mmcv-full
#### 1. 安装 torch_npu 在编译 mmcv-full 前,需要安装 torch_npu,完整安装教程详见 [PyTorch 安装指南](https://gitee.com/ascend/pytorch/blob/master/docs/zh/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97.md#pytorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97)
- torch_npu 完整安装教程详见 [PyTorch安装指南](https://gitee.com/ascend/pytorch/blob/master/docs/zh/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97.md#pytorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97) #### 选项 1: 使用 pip 安装 Ascend 编译版本的 mmcv-full
#### 2. 编译 MMCV NPU Ascend 编译版本的 mmcv-full 在 mmcv >= 1.7.0 时已经支持直接 pip 安装
拉取 [MMCV 源码](https://github.com/open-mmlab/mmcv/tree/master) 进行编译安装 ```bash
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/ascend/torch1.8.0/index.html
```
#### 选项 2: 使用 NPU 设备源码编译安装 mmcv-full
- 拉取 [MMCV 源码](https://github.com/open-mmlab/mmcv/tree/master)
```bash
git pull https://github.com/open-mmlab/mmcv/tree/master
```
编译 - 编译
```bash ```bash
MMCV_WITH_OPS=1 MAX_JOBS=8 FORCE_NPU=1 python setup.py build_ext MMCV_WITH_OPS=1 MAX_JOBS=8 FORCE_NPU=1 python setup.py build_ext
``` ```
安装 - 安装
```bash ```bash
MMCV_WITH_OPS=1 FORCE_NPU=1 python setup.py develop MMCV_WITH_OPS=1 FORCE_NPU=1 python setup.py develop
``` ```
验证 #### 验证
```python ```python
import torch import torch
import torch_npu import torch_npu
from mmcv.ops import softmax_focal_loss from mmcv.ops import softmax_focal_loss
# Init tensor to the NPU
x = torch.randn(3, 10).npu() x = torch.randn(3, 10).npu()
x.requires_grad = True
y = torch.tensor([1, 5, 3]).npu() y = torch.tensor([1, 5, 3]).npu()
w = torch.ones(10).float().npu() w = torch.ones(10).float().npu()
output = softmax_focal_loss(x, y, 2.0, 0.25, w, 'none')
```
使用说明: output = softmax_focal_loss(x, y, 2.0, 0.25, w, 'none')
print(output)
```{note}
在 tensor 末尾加上 .npu() 就可以调用到 npu 算子
``` ```
...@@ -2,61 +2,61 @@ ...@@ -2,61 +2,61 @@
MMCV 提供了检测、分割等任务中常用的算子 MMCV 提供了检测、分割等任务中常用的算子
| Device | CPU | CUDA | MLU | MPS | NPU | | Device | CPU | CUDA | MLU | MPS | Ascend |
| ---------------------------- | --- | ---- | --- | --- | --- | | ---------------------------- | --- | ---- | --- | --- | ------ |
| ActiveRotatedFilter | √ | √ | | | | | ActiveRotatedFilter | √ | √ | | | |
| AssignScoreWithK | | √ | | | | | AssignScoreWithK | | √ | | | |
| BallQuery | | √ | | | | | BallQuery | | √ | | | |
| BBoxOverlaps | | √ | √ | √ | | | BBoxOverlaps | | √ | √ | √ | |
| BorderAlign | | √ | | | | | BorderAlign | | √ | | | |
| BoxIouRotated | √ | √ | | | | | BoxIouRotated | √ | √ | | | |
| BoxIouQuadri | √ | √ | | | | | BoxIouQuadri | √ | √ | | | |
| CARAFE | | √ | √ | | | | CARAFE | | √ | √ | | |
| ChamferDistance | | √ | | | | | ChamferDistance | | √ | | | |
| CrissCrossAttention | | √ | | | | | CrissCrossAttention | | √ | | | |
| ContourExpand | √ | | | | | | ContourExpand | √ | | | | |
| ConvexIoU | | √ | | | | | ConvexIoU | | √ | | | |
| CornerPool | | √ | | | | | CornerPool | | √ | | | |
| Correlation | | √ | | | | | Correlation | | √ | | | |
| Deformable Convolution v1/v2 | √ | √ | | | | | Deformable Convolution v1/v2 | √ | √ | | | |
| Deformable RoIPool | | √ | √ | | | | Deformable RoIPool | | √ | √ | | |
| DiffIoURotated | | √ | | | | | DiffIoURotated | | √ | | | |
| DynamicScatter | | √ | | | | | DynamicScatter | | √ | | | |
| FurthestPointSample | | √ | | | | | FurthestPointSample | | √ | | | |
| FurthestPointSampleWithDist | | √ | | | | | FurthestPointSampleWithDist | | √ | | | |
| FusedBiasLeakyrelu | | √ | | | | | FusedBiasLeakyrelu | | √ | | | |
| GatherPoints | | √ | | | | | GatherPoints | | √ | | | |
| GroupPoints | | √ | | | | | GroupPoints | | √ | | | |
| Iou3d | | √ | √ | | | | Iou3d | | √ | √ | | |
| KNN | | √ | | | | | KNN | | √ | | | |
| MaskedConv | | √ | √ | | √ | | MaskedConv | | √ | √ | | √ |
| MergeCells | | √ | | | | | MergeCells | | √ | | | |
| MinAreaPolygon | | √ | | | | | MinAreaPolygon | | √ | | | |
| ModulatedDeformConv2d | √ | √ | √ | | √ | | ModulatedDeformConv2d | √ | √ | √ | | √ |
| MultiScaleDeformableAttn | | √ | √ | | | | MultiScaleDeformableAttn | | √ | √ | | |
| NMS | √ | √ | √ | | √ | | NMS | √ | √ | √ | | √ |
| NMSRotated | √ | √ | | | | | NMSRotated | √ | √ | | | |
| NMSQuadri | √ | √ | | | | | NMSQuadri | √ | √ | | | |
| PixelGroup | √ | | | | | | PixelGroup | √ | | | | |
| PointsInBoxes | √ | √ | | | | | PointsInBoxes | √ | √ | | | |
| PointsInPolygons | | √ | | | | | PointsInPolygons | | √ | | | |
| PSAMask | √ | √ | √ | | | | PSAMask | √ | √ | √ | | |
| RotatedFeatureAlign | √ | √ | | | | | RotatedFeatureAlign | √ | √ | | | |
| RoIPointPool3d | | √ | √ | | | | RoIPointPool3d | | √ | √ | | |
| RoIPool | | √ | √ | | | | RoIPool | | √ | √ | | |
| RoIAlignRotated | √ | √ | √ | | | | RoIAlignRotated | √ | √ | √ | | |
| RiRoIAlignRotated | | √ | | | | | RiRoIAlignRotated | | √ | | | |
| RoIAlign | √ | √ | √ | | | | RoIAlign | √ | √ | √ | | |
| RoIAwarePool3d | | √ | √ | | | | RoIAwarePool3d | | √ | √ | | |
| SAConv2d | | √ | | | | | SAConv2d | | √ | | | |
| SigmoidFocalLoss | | √ | √ | | √ | | SigmoidFocalLoss | | √ | √ | | √ |
| SoftmaxFocalLoss | | √ | | | √ | | SoftmaxFocalLoss | | √ | | | √ |
| SoftNMS | | √ | | | | | SoftNMS | | √ | | | |
| Sparse Convolution | | √ | | | | | Sparse Convolution | | √ | | | |
| Synchronized BatchNorm | | √ | | | | | Synchronized BatchNorm | | √ | | | |
| ThreeInterpolate | | √ | | | | | ThreeInterpolate | | √ | | | |
| ThreeNN | | √ | √ | | | | ThreeNN | | √ | √ | | |
| TINShift | | √ | √ | | | | TINShift | | √ | √ | | |
| UpFirDn2d | | √ | | | | | UpFirDn2d | | √ | | | |
| Voxelization | √ | √ | | | | | Voxelization | √ | √ | | | |
| PrRoIPool | | √ | | | | | PrRoIPool | | √ | | | |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment