Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4146762193 | ||
|
|
c24a2a26f2 | ||
|
|
99baa47bac | ||
|
|
3aad7226de | ||
|
|
2c1766a041 | ||
|
|
58402d67d2 | ||
|
|
22a5bf8eba | ||
|
|
7ec3a5a42a | ||
|
|
8611e0e3d5 | ||
|
|
a2ed4eb074 | ||
|
|
c6d5d99656 | ||
|
|
c927f4d52e | ||
|
|
a52a2a7582 | ||
|
|
28b81ba784 | ||
|
|
118cead9db | ||
|
|
37983612eb | ||
|
|
a0d5f0413a | ||
|
|
3f7654bb90 | ||
|
|
6f3c3f8c93 | ||
|
|
663e48a628 | ||
|
|
4c0b1766ab | ||
|
|
69547a0826 | ||
|
|
5b9b7041b2 | ||
|
|
bc0fbdcac9 | ||
|
|
ea561b97c9 | ||
|
|
f431153967 | ||
|
|
e82066018d | ||
|
|
a4fdc51ac9 | ||
|
|
42badebbad | ||
|
|
9d43973a43 | ||
|
|
9d4224f9a5 | ||
|
|
c2a7dc3f17 | ||
|
|
be21b4c339 | ||
|
|
851cc9e42e | ||
|
|
6963a9c6f5 | ||
|
|
f38ae2d871 | ||
|
|
cc3ebabbca | ||
|
|
d70ae50d78 | ||
|
|
f99298b02b | ||
|
|
8d64c91316 | ||
|
|
a40e37d953 | ||
|
|
5996fed7b1 | ||
|
|
3be7bcf63d | ||
|
|
6fc30ad19f | ||
|
|
81a39d545f | ||
|
|
75a9089e09 | ||
|
|
b256f3cfcd | ||
|
|
a03b990d2f | ||
|
|
b1de459aab | ||
|
|
78bb23dcfc | ||
|
|
358e163e2b | ||
|
|
e3cacd1240 | ||
|
|
5a675a23c2 | ||
|
|
62e6edd1be | ||
|
|
8b0bb12ed2 | ||
|
|
08895e3452 | ||
|
|
eb19e5be07 | ||
|
|
dbbb5b935b | ||
|
|
27b2513f2f | ||
|
|
18cee26cfb | ||
|
|
d9c203af66 | ||
|
|
a96f349728 | ||
|
|
08d67bb93b | ||
|
|
9d1f8c2062 | ||
|
|
e56d176f63 | ||
|
|
46d2c88c76 | ||
|
|
16c6efb99c | ||
|
|
3deb4f4041 | ||
|
|
63f22cf38d | ||
|
|
95bc96954a | ||
|
|
a323bfb26d | ||
|
|
4c28fae7ff | ||
|
|
d73f7d15d1 | ||
|
|
64142762fb | ||
|
|
2671012415 | ||
|
|
9cb88c4ae8 | ||
|
|
3015977115 | ||
|
|
25e1415cb4 | ||
|
|
9276d4c441 | ||
|
|
3ab4642abd | ||
|
|
aa1466742a | ||
|
|
9bfd72d468 | ||
|
|
0fa13028d3 | ||
|
|
358cba8b6d | ||
|
|
c684b7c74a | ||
|
|
d836a9cb3c | ||
|
|
369ebefd2e | ||
|
|
e1b754a902 | ||
|
|
c6ad5c5cc5 | ||
|
|
54af470c20 | ||
|
|
c56e5299d5 | ||
|
|
edfe8b0306 | ||
|
|
0143c1c06e | ||
|
|
fe09035482 | ||
|
|
e8f0e0055c | ||
|
|
255e1b94f6 | ||
|
|
b184e1c1d3 | ||
|
|
a85cb62301 | ||
|
|
1500208c7f | ||
|
|
073ad70cc4 | ||
|
|
6741696481 | ||
|
|
48dd2489e0 | ||
|
|
7e0b4081ac | ||
|
|
88d5c2c545 | ||
|
|
c39847cbba | ||
|
|
8fa79690b2 | ||
|
|
b6464ff2b2 | ||
|
|
a12b0dd319 | ||
|
|
b9c513ed2d | ||
|
|
e7218aaf60 | ||
|
|
5de5ce6d04 | ||
|
|
62992d4000 | ||
|
|
34f84c6ca4 | ||
|
|
4ebeb1fd6a | ||
|
|
c4c5da1ed0 | ||
|
|
4ad96e17f4 | ||
|
|
f6bd4ea357 | ||
|
|
6c52cd2a5d | ||
|
|
11ee398a57 | ||
|
|
c4c9340104 | ||
|
|
931f3c3878 | ||
|
|
a48b4fd558 | ||
|
|
d44bc70aae | ||
|
|
021efdf1da | ||
|
|
1d607dcf4f | ||
|
|
b2afdd7871 | ||
|
|
37fc10168a | ||
|
|
6432bc6349 | ||
|
|
4160ab8ab6 | ||
|
|
afaa4d4e88 | ||
|
|
91014cd3b8 | ||
|
|
798f0c3b16 | ||
|
|
c28c47c9cd | ||
|
|
bda914c574 | ||
|
|
edb5c70443 | ||
|
|
4689a0514b | ||
|
|
63950d1412 | ||
|
|
16fb2692c6 | ||
|
|
193cd1f80d | ||
|
|
6b5302218a |
@@ -1,6 +1,7 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, 张昱杰
|
||||
Copyright (c) 2020, Huawei Technologies Co., Ltd
|
||||
Copyright (c) 2019, Facebook CORPORATION.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -13,4 +13,7 @@ reviewers:
|
||||
- wangyu0516
|
||||
- yskhhh
|
||||
- lvpeiyuan
|
||||
- xchu42
|
||||
- xchu42
|
||||
- weili10
|
||||
- goodjobwubai
|
||||
- fairwarning
|
||||
@@ -10,7 +10,7 @@ gcc版本: 7.3.0(只在编译场景要求)
|
||||
|
||||
cmake版本:3.12.0以上版本(只在编译场景要求)
|
||||
|
||||
python版本:3.7.x
|
||||
python版本:3.7.5 和 3.8.x(编译方法有差别,详见脚本编译章节)
|
||||
|
||||
|
||||
# 系统依赖库
|
||||
@@ -24,24 +24,25 @@ yum install -y cmake zlib-devel libffi-devel openssl-devel libjpeg-turbo-devel g
|
||||
apt-get install -y gcc g++ make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev m4 cmake dos2unix libopenblas-dev
|
||||
|
||||
|
||||
# python依赖库
|
||||
# Ascend配套软件
|
||||
|
||||
|
||||
依赖库安装:
|
||||
|
||||
```python3
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
| AscendPyTorch版本 | CANN版本 |
|
||||
| :------------ | :----------- |
|
||||
| 2.0.2 | CANN 5.0.2 |
|
||||
| 2.0.3 | CANN 5.0.3 |
|
||||
|
||||
|
||||
# 使用方式 --生成全量代码并编译
|
||||
|
||||
## 获取原生PyTorch源代码和third_party代码
|
||||
|
||||
在当前仓库根目录pytorch/下获取原生PyTorch的源代码
|
||||
当前支持pytorch 1.5.0和1.8.1的版本。根据需求,在当前仓库根目录pytorch/下获取原生PyTorch的源代码
|
||||
|
||||
```sh
|
||||
// 1.5.0 版本
|
||||
git clone -b v1.5.0 --depth=1 https://github.com/pytorch/pytorch.git
|
||||
// 1.8.1 版本
|
||||
git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
|
||||
```
|
||||
|
||||
进入到pytorch/pytorch/目录下, 获取PyTorch被动依赖代码(获取时间较长,请耐心等待)。
|
||||
@@ -55,26 +56,47 @@ git submodule update --init --recursive
|
||||
|
||||
## 生成适配昇腾AI处理器的PyTorch代码。
|
||||
|
||||
进入到pytorch/scripts目录,执行
|
||||
进入到pytorch/scripts目录,根据选择的版本执行,执行脚本(注意:下载原生Pytorch源代码和下面版本要对应,否则可能出错)
|
||||
|
||||
```sh
|
||||
// 默认为1.5.0版本
|
||||
bash gen.sh
|
||||
// 对于1.8.1版本,则通过-v 参数指定
|
||||
bash gen.sh -v 1.8.1
|
||||
```
|
||||
|
||||
会在pytorch/pytorch/目录中生成npu适配全量代码
|
||||
|
||||
|
||||
## python依赖库
|
||||
|
||||
进入到pytorch/pytorch/目录,依赖库安装:
|
||||
|
||||
```python3
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
|
||||
## 编译torch的二进制包
|
||||
|
||||
进入到pytorch/pytorch/目录,执行
|
||||
|
||||
```sh
|
||||
# python3.7版本
|
||||
bash build.sh
|
||||
或者
|
||||
bash build.sh --python=3.7(推荐)
|
||||
|
||||
# python3.8版本
|
||||
bash build.sh --python=3.8
|
||||
```
|
||||
|
||||
生成的二进制包在pytorch/pytorch/dist/目录下
|
||||
|
||||
# 安装
|
||||
|
||||
### (以1.5.0版本为例,1.8.1版本同理)
|
||||
|
||||
**x86_64:**
|
||||
|
||||
torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl (实际可能附带小版本号例如torch-1.5.0.post2+ascend-cp37-cp37m-linux_x86_64.whl)
|
||||
@@ -102,7 +124,7 @@ pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl
|
||||
在当前仓库根目录中执行设置环境变量脚本
|
||||
|
||||
```
|
||||
source src/env.sh
|
||||
source pytorch/env.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -131,7 +153,10 @@ export DYNAMIC_OP="ADD#MUL" # 算子实现,ADD和MUL算子在不同场景下
|
||||
验证运行, 输出结果OK
|
||||
|
||||
```python
|
||||
python3 test/test_npu/test_div.py
|
||||
// 根据前述版本,选择对应的测试脚本,以下为1.5.0版本
|
||||
python3 pytorch1.5.0/test/test_npu/test_div.py
|
||||
// 以下为1.8.1版本
|
||||
python3 pytorch1.8.1/test/test_npu/test_div.py
|
||||
```
|
||||
|
||||
# 路标
|
||||
@@ -158,6 +183,23 @@ python3 test/test_npu/test_div.py
|
||||
|
||||
热忱希望各位在用户社区加入讨论,并贡献您的建议。
|
||||
|
||||
# 分支维护策略
|
||||
|
||||
Ascend PyTorch的版本分支有以下几种维护阶段:
|
||||
|
||||
| **状态** | **持续时间** | **说明** |
|
||||
|-------------|---------------|--------------------------------------------------|
|
||||
| Planning | 1 - 3 months | 特性规划。 |
|
||||
| Development | 3 months | 特性开发。 |
|
||||
| Maintained | 6 - 12 months | 允许所有问题修复的合入,并发布版本。 |
|
||||
| Unmaintained| 0 - 3 months | 允许所有问题修复的合入,无专人维护,不再发布版本。 |
|
||||
| End Of Life (EOL) | N/A | 不再接受修改合入该分支。 |
|
||||
|
||||
# 现有分支维护状态
|
||||
|
||||
| **分支名** | **当前状态** | **上线时间** | **后续状态** | **EOL 日期**|
|
||||
|------------|--------------|----------------------|----------------------------------------|------------|
|
||||
| **v2.0.2** | Maintained | 2021-07-29 | Unmaintained <br> 2022-07-29 estimated | |
|
||||
|
||||
|
||||
# FAQ
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
OPEN SOURCE SOFTWARE NOTICE
|
||||
|
||||
Please note we provide an open source software notice along with this product and/or this product firmware (in the following just “this product”). The open source software licenses are granted by the respective right holders. And the open source licenses prevail all other license information with regard to the respective open source software contained in the product, including but not limited to End User Software Licensing Agreement. This notice is provided on behalf of Huawei Technologies Co. Ltd. and any of its local subsidiaries which may have provided this product to you in your local country.
|
||||
|
||||
Warranty Disclaimer
|
||||
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
||||
|
||||
Copyright Notice and License Texts
|
||||
|
||||
Software: pytorch 1.5.0
|
||||
Copyright notice:
|
||||
Copyright (c) 2016-present, Facebook, Inc.
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
Copyright 2006, Google Inc.
|
||||
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
|
||||
2017-2018 Advanced Micro Devices, Inc. and Facebook Inc. All rights reserved.
|
||||
Copyright 2004-present Facebook. All Rights Reserved.
|
||||
Copyright (c) 2018 MathInf GmbH, Thomas Viehmann
|
||||
Copyright (c) 2014 Indiana University
|
||||
Copyright (c) 2016, NVIDIA CORPORATION, All rights reserved
|
||||
Copyright (C) 2012 Giovanni Garberoglio
|
||||
Copyright 2015 Google Inc. All Rights Reserved.
|
||||
Copyright (c) Facebook Inc. and Microsoft Corporation.
|
||||
Copyright © 2001-2014 Python Software Foundation
|
||||
All Rights Reserved
|
||||
Copyright (c) 2014-2015 The Khronos Group Inc.
|
||||
Copyright (c) 2006, Laurent Montel, montel@kde.org
|
||||
Copyright 2013 Conrad Steenberg conrad.steenberg@gmail.com
|
||||
Copyright (C) 2017 The Android Open Source Project
|
||||
Copyright (c) 2010-2017 Benjamin Peterson
|
||||
Copyright 2013-2014 RAD Game Tools and Valve Software
|
||||
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
||||
Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
Copyright (c) 2007-2009 Scientific Computing and Imaging Institute, University of Utah
|
||||
(c) Facebook, Inc. and its affiliates. Confidential and proprietary.
|
||||
Copyright (c) 2017 by Contributors
|
||||
Copyright 2016 Facebook
|
||||
Copyright (C) 2018 Marat Dukhan
|
||||
Copyright (c) 2017-2018 Facebook Inc.
|
||||
Copyright (c) 2017 Georgia Institute of Technology
|
||||
Copyright (c) 2016 Microsoft
|
||||
Copyright (c) 2014, 2015, The Regents of the University of California
|
||||
Copyright (c) 2014, 2015, the respective contributors
|
||||
Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
|
||||
Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
|
||||
Copyright (c) 2011-2013 NYU (Clement Farabet)
|
||||
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert,Leon Bottou, Iain Melvin, Jason Weston)
|
||||
Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
|
||||
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert,Samy Bengio, Johnny Mariethoz)
|
||||
Copyright (c) 2016-2017, ARM Limited and Contributors
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||
Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
||||
Copyright Malte Skarupke 2017.
|
||||
Copyright (C) 2011 - 2012 Andrzej Krzemienski.
|
||||
Copyright (C) 2001-2019 Free Software Foundation, Inc.
|
||||
Copyright (c) 1994 Hewlett-Packard Company
|
||||
Copyright (c) 1996-1998 Silicon Graphics Computer Systems, Inc.
|
||||
Copyright Michael Park, 2015-2017
|
||||
Copyright (c) 2008 - 2012 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2013 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
Copyright (C) 2006 The Android Open Source Project
|
||||
Copyright (c) 2016- Facebook, Inc (Adam Paszke)
|
||||
Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
|
||||
Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
|
||||
Copyright (c) 2011-2013 NYU (Clement Farabet)
|
||||
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
|
||||
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
|
||||
Copyright (c) 2016-present, Facebook Inc. All rights reserved.
|
||||
Copyright (c) 2016 Facebook Inc.
|
||||
Copyright (c) 2015 Google Inc.
|
||||
Copyright (c) 2015 Yangqing Jia
|
||||
Copyright(c) 2013, 2014, 2015, the respective contributors
|
||||
Copyright(c) 2015, 2016 the respective contributors
|
||||
Copyright (c) 2014, The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014, the respective contributors
|
||||
Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
Copyright (c) 2014-2017 The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014-2017, the respective contributors
|
||||
Copyright (c) 2017 Microsoft
|
||||
Copyright (c) 2017-present, Facebook, Inc.
|
||||
Copyright (c) 2018-present, Facebook, Inc.
|
||||
|
||||
License: BSD 3-Clause License
|
||||
Please see above.
|
||||
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
@@ -1,74 +1,59 @@
|
||||
# PyTorch在线推理指南
|
||||
- [使用场景](#使用场景.md)
|
||||
- [基本使用流程](#基本使用流程.md)
|
||||
- [前提条件](#前提条件.md)
|
||||
- [在线推理流程](#在线推理流程.md)
|
||||
- [环境变量配置](#环境变量配置.md)
|
||||
- [样例参考](#样例参考.md)
|
||||
- [专题](#专题.md)
|
||||
- [混合精度](#混合精度.md)
|
||||
- [权重更新](#权重更新.md)
|
||||
- [FAQ](#FAQ.md)
|
||||
- [pip3.7 install Pillow==5.3.0安装失败](#pip3-7-install-Pillow-5-3-0安装失败.md)
|
||||
- [安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配.md)
|
||||
- [安装7.3.0版本gcc](#安装7-3-0版本gcc.md)
|
||||
<h2 id="使用场景.md">使用场景</h2>
|
||||
- [使用场景](#使用场景md)
|
||||
- [基本使用流程](#基本使用流程md)
|
||||
- [前提条件](#前提条件md)
|
||||
- [在线推理流程](#在线推理流程md)
|
||||
- [环境变量配置](#环境变量配置md)
|
||||
- [样例参考](#样例参考md)
|
||||
- [专题](#专题md)
|
||||
- [混合精度](#混合精度md)
|
||||
- [安装7.3.0版本gcc](#安装7-3-0版本gccmd)
|
||||
<h2 id="使用场景md">使用场景</h2>
|
||||
|
||||
在线推理是在AI框架内执行推理的场景,例如在PyTorch框架上,加载模型后,通过model.eval\(\)执行推理。
|
||||
在线推理是在AI框架内执行推理的场景,例如在PyTorch框架上,加载模型后,通过“model.eval\(\)“将模型切换为推理模式。
|
||||
|
||||
相比于离线推理场景,使用在线推理可以方便将原来基于PyTorch框架做推理的应用快速迁移到昇腾AI处理器,适用于数据中心推理场景。
|
||||
|
||||
## 支持的芯片型号<a name="section15598658104219"></a>
|
||||
### 支持的芯片型号<a name="section15598658104219"></a>
|
||||
|
||||
昇腾910 AI处理器
|
||||
|
||||
昇腾710 AI处理器
|
||||
|
||||
<h2 id="基本使用流程.md">基本使用流程</h2>
|
||||
<h2 id="基本使用流程md">基本使用流程</h2>
|
||||
|
||||
- **[前提条件](#前提条件.md)**
|
||||
- **[前提条件](#前提条件md)**
|
||||
|
||||
- **[在线推理流程](#在线推理流程.md)**
|
||||
- **[在线推理流程](#在线推理流程md)**
|
||||
|
||||
- **[环境变量配置](#环境变量配置.md)**
|
||||
- **[环境变量配置](#环境变量配置md)**
|
||||
|
||||
- **[样例参考](#样例参考.md)**
|
||||
- **[样例参考](#样例参考md)**
|
||||
|
||||
|
||||
<h2 id="前提条件.md">前提条件</h2>
|
||||
<h3 id="前提条件md">前提条件</h3>
|
||||
|
||||
已完成PyTorch框架及混合精度模块的安装,详情请参考《PyTorch网络模型移植&训练指南》的"环境准备"章节。
|
||||
已完成PyTorch框架及混合精度模块的安装,详情请参见《PyTorch安装指南》进行PyTorch相关运行环境搭建。
|
||||
|
||||
<h2 id="在线推理流程.md">在线推理流程</h2>
|
||||
<h3 id="在线推理流程md">在线推理流程</h3>
|
||||
|
||||
在线推理流程如[图1](#fig13802941161818)所示:
|
||||
在线推理流程如[图1](#fig13802941161818)所示。
|
||||
|
||||
**图 1** 在线推理流程图<a name="fig13802941161818"></a>
|
||||

|
||||
|
||||
<h2 id="环境变量配置.md">环境变量配置</h2>
|
||||
<h3 id="环境变量配置md">环境变量配置</h3>
|
||||
|
||||
Pytorch在线推理进程启动所依赖的环境变量:
|
||||
|
||||
根据环境实际安装的软件包(toolkit或nnae),在下列场景中选择一个并运行对应的环境变量配置脚本。
|
||||
PyTorch在线推理进程启动所依赖的环境变量:
|
||||
|
||||
```
|
||||
# 场景一:昇腾设备安装部署开发套件包Ascend-cann-toolkit(此时开发环境可进行推理任务),可根据不同安装用户执行相应脚本。
|
||||
# 以root用户安装toolkit包
|
||||
. /usr/local/Ascend/ascend-toolkit/set_env.sh
|
||||
# 以非root用户安装toolkit包
|
||||
. ${HOME}/Ascend/ascend-toolkit/set_env.sh
|
||||
# 场景二:昇腾设备安装部署软件包Ascend-cann-nnae,可根据不同安装用户执行相应脚本。
|
||||
# 以root用户安装nnae包
|
||||
. /usr/local/Ascend/nnae/set_env.sh
|
||||
# 以非root用户安装nnae包
|
||||
. ${HOME}/Ascend/nnae/set_env.sh
|
||||
```
|
||||
# 请依据实际在下列场景中选择其一,进行在线推理依赖包安装路径的环境变量设置。具体如下(以HwHiAiUser用户安装,安装路径为默认路径为例):
|
||||
# 场景一:昇腾设备安装部署开发套件包Ascend-cann-toolkit(此时开发环境可进行推理任务)。
|
||||
. /home/HwHiAiUser/Ascend/ascend-toolkit/set_env.sh
|
||||
# 场景二:昇腾设备安装部署软件包Ascend-cann-nnae。
|
||||
. /home/HwHiAiUser/Ascend/nnae/set_env.sh
|
||||
|
||||
其他环境变量配置。
|
||||
|
||||
```
|
||||
# 若参见《PyTorch网络模型移植&训练指南》的"环境准备"章节进行环境搭建时安装python3.7.5,或存在多个python3版本时,需要在环境变量中配置python3.7.5的安装路径。
|
||||
# 若运行环境中存在多个python3版本时,需要在环境变量中配置python3.7.5的安装路径。
|
||||
export PATH=/usr/local/python3.7.5/bin:$PATH
|
||||
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
|
||||
|
||||
@@ -78,63 +63,65 @@ export ASCEND_DEVICE_ID=0
|
||||
# 输出日志信息,可根据实际修改
|
||||
export ASCEND_SLOG_PRINT_TO_STDOUT=1
|
||||
export ASCEND_GLOBAL_LOG_LEVEL=0
|
||||
|
||||
# TASK多线程下发
|
||||
export TASK_QUEUE_ENABLE=0
|
||||
```
|
||||
|
||||
**表 1**
|
||||
**表 1** 环境变量说明
|
||||
|
||||
<a name="table2072027194819"></a>
|
||||
<table><thead align="left"><tr id="row1173527114812"><th class="cellrowborder" valign="top" width="46.75467546754676%" id="mcps1.2.4.1.1"><p id="p073027114816"><a name="p073027114816"></a><a name="p073027114816"></a>配置项</p>
|
||||
<table><thead align="left"><tr id="row1173527114812"><th class="cellrowborder" valign="top" width="35.51355135513551%" id="mcps1.2.4.1.1"><p id="p073027114816"><a name="p073027114816"></a><a name="p073027114816"></a>配置项</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="43.18431843184319%" id="mcps1.2.4.1.2"><p id="p157362712480"><a name="p157362712480"></a><a name="p157362712480"></a>说明</p>
|
||||
<th class="cellrowborder" valign="top" width="54.42544254425443%" id="mcps1.2.4.1.2"><p id="p157362712480"><a name="p157362712480"></a><a name="p157362712480"></a>说明</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="10.061006100610062%" id="mcps1.2.4.1.3"><p id="p187392714485"><a name="p187392714485"></a><a name="p187392714485"></a>必选/可选</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row2732273481"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p57382719481"><a name="p57382719481"></a><a name="p57382719481"></a>LD_LIBRARY_PATH</p>
|
||||
<tbody><tr id="row2732273481"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p57382719481"><a name="p57382719481"></a><a name="p57382719481"></a>LD_LIBRARY_PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p07319271480"><a name="p07319271480"></a><a name="p07319271480"></a>动态库的查找路径,参考上述举例配置。</p>
|
||||
<div class="note" id="note119943144912"><a name="note119943144912"></a><a name="note119943144912"></a><span class="notetitle"> 说明: </span><div class="notebody"><p id="p49933104915"><a name="p49933104915"></a><a name="p49933104915"></a>若系统环境升级了gcc版本(例如Centos、Debian和BClinux系统),需要配置gcc相关环境变量,详情请参见<a href="#安装7-3-0版本gcc.md#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l5e5c9395407d46439788b12f0e6342bc">5</a>。</p>
|
||||
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p07319271480"><a name="p07319271480"></a><a name="p07319271480"></a>动态库的查找路径,参考上述举例配置。</p>
|
||||
<div class="note" id="note119943144912"><a name="note119943144912"></a><a name="note119943144912"></a><span class="notetitle"> 说明: </span><div class="notebody"><p id="p49933104915"><a name="p49933104915"></a><a name="p49933104915"></a>若系统环境安装了gcc7.3.0(例如CentOS7.6、Debian和BClinux系统),需要配置gcc相关环境变量,详情请参见<a href="#安装7-3-0版本gccmd#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l5e5c9395407d46439788b12f0e6342bc">5</a>。</p>
|
||||
</div></div>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p187352744817"><a name="p187352744817"></a><a name="p187352744817"></a>必选</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17342744812"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p4731227184818"><a name="p4731227184818"></a><a name="p4731227184818"></a>PATH</p>
|
||||
<tr id="row17342744812"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p4731227184818"><a name="p4731227184818"></a><a name="p4731227184818"></a>PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p97310276484"><a name="p97310276484"></a><a name="p97310276484"></a>可执行程序的查找路径,参考上述举例配置。</p>
|
||||
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p97310276484"><a name="p97310276484"></a><a name="p97310276484"></a>可执行程序的查找路径,参考上述举例配置。</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p1573142711483"><a name="p1573142711483"></a><a name="p1573142711483"></a>必选</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row95241840165613"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p15242404566"><a name="p15242404566"></a><a name="p15242404566"></a>ASCEND_DEVICE_ID</p>
|
||||
<tr id="row95241840165613"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p15242404566"><a name="p15242404566"></a><a name="p15242404566"></a>ASCEND_DEVICE_ID</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p688447526"><a name="p688447526"></a><a name="p688447526"></a>指定芯片的逻辑ID。</p>
|
||||
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p688447526"><a name="p688447526"></a><a name="p688447526"></a>指定芯片的逻辑ID。</p>
|
||||
<p id="p178824712212"><a name="p178824712212"></a><a name="p178824712212"></a>取值范围[0,N-1],默认为0。其中N为当前物理机/虚拟机/容器内的设备总数。</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p105245400562"><a name="p105245400562"></a><a name="p105245400562"></a>可选</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row203705529819"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p53705522810"><a name="p53705522810"></a><a name="p53705522810"></a>ASCEND_SLOG_PRINT_TO_STDOUT</p>
|
||||
<tr id="row203705529819"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p53705522810"><a name="p53705522810"></a><a name="p53705522810"></a>ASCEND_SLOG_PRINT_TO_STDOUT</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073203258_p763102116322"><a name="zh-cn_topic_0000001073203258_p763102116322"></a><a name="zh-cn_topic_0000001073203258_p763102116322"></a>是否开启日志打屏。取值:</p>
|
||||
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073203258_p763102116322"><a name="zh-cn_topic_0000001073203258_p763102116322"></a><a name="zh-cn_topic_0000001073203258_p763102116322"></a>是否开启日志打屏。取值:</p>
|
||||
<a name="zh-cn_topic_0000001073203258_ul95291245104113"></a><a name="zh-cn_topic_0000001073203258_ul95291245104113"></a><ul id="zh-cn_topic_0000001073203258_ul95291245104113"><li>0或不配置:关闭日志打屏</li><li>1:开启日志打屏</li></ul>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p6370125217818"><a name="p6370125217818"></a><a name="p6370125217818"></a>可选</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row188405280914"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p5840928594"><a name="p5840928594"></a><a name="p5840928594"></a>ASCEND_GLOBAL_LOG_LEVEL</p>
|
||||
<tr id="row188405280914"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p5840928594"><a name="p5840928594"></a><a name="p5840928594"></a>ASCEND_GLOBAL_LOG_LEVEL</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073521184_p763102116322"><a name="zh-cn_topic_0000001073521184_p763102116322"></a><a name="zh-cn_topic_0000001073521184_p763102116322"></a>设置日志的全局日志级别。取值:</p>
|
||||
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073521184_p763102116322"><a name="zh-cn_topic_0000001073521184_p763102116322"></a><a name="zh-cn_topic_0000001073521184_p763102116322"></a>设置日志的全局日志级别。取值:</p>
|
||||
<a name="zh-cn_topic_0000001073521184_u4d735da6e0494e55abbf5eb6aefe988d"></a><a name="zh-cn_topic_0000001073521184_u4d735da6e0494e55abbf5eb6aefe988d"></a><ul id="zh-cn_topic_0000001073521184_u4d735da6e0494e55abbf5eb6aefe988d"><li>0:对应DEBUG级别。</li><li>1:对应INFO级别。</li><li>2:对应WARNING级别。</li><li>3:对应ERROR级别。</li><li>4:对应NULL级别,不输出日志。</li><li>其他值为非法值。</li></ul>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p6841928598"><a name="p6841928598"></a><a name="p6841928598"></a>可选</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17638114219104"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p20638342191018"><a name="p20638342191018"></a><a name="p20638342191018"></a>TASK_QUEUE_ENABLE</p>
|
||||
<tr id="row17638114219104"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p20638342191018"><a name="p20638342191018"></a><a name="p20638342191018"></a>TASK_QUEUE_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p126381842151019"><a name="p126381842151019"></a><a name="p126381842151019"></a>s是否开启TASK多线程下发,绝大多数情况下,打开该功能会进一步提升整网训练性能。取值:</p>
|
||||
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p126381842151019"><a name="p126381842151019"></a><a name="p126381842151019"></a>是否开启TASK多线程下发,绝大多数情况下,打开该功能会进一步提升整网训练性能。取值:</p>
|
||||
<a name="ul6194152711118"></a><a name="ul6194152711118"></a><ul id="ul6194152711118"><li>0或不配置:关闭TASK多线程下发。</li><li>1:开启TASK多线程下发。</li></ul>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p86386423103"><a name="p86386423103"></a><a name="p86386423103"></a>可选</p>
|
||||
@@ -146,11 +133,13 @@ export TASK_QUEUE_ENABLE=0
|
||||
> **说明:**
|
||||
>更多日志信息,请参见《CANN 日志参考》。
|
||||
|
||||
<h2 id="样例参考.md">样例参考</h2>
|
||||
<h3 id="样例参考md">样例参考</h3>
|
||||
|
||||
## 样例代码<a name="section2017032418274"></a>
|
||||
#### 样例代码<a name="section2017032418274"></a>
|
||||
|
||||
在进行推理应用时,应尽量保证应用在生命周期内不频繁初始化。推理模式通过模型model.eval\(\)进行设置,并且推理过程要在“with torch.no\_grad\(\):”代码分支下运行。本例中,我们将使用Resnet50网络的python代码进行说明。
|
||||
在进行推理应用时,应尽量保证应用在生命周期内不频繁初始化。推理模式通过模型model.eval\(\)进行设置,并且推理过程要在“with torch.no\_grad\(\):”代码分支下运行。
|
||||
|
||||
本例中,我们将使用Resnet50网络的python代码进行说明。
|
||||
|
||||
样例代码 resnet50\_infer\_for\_pytorch.py:
|
||||
|
||||
@@ -246,7 +235,7 @@ def main_worker(npu, args):
|
||||
print("=> creating model '{}'".format(args.arch))
|
||||
model = models.__dict__[args.arch](zero_init_residual=True)
|
||||
|
||||
# 将模型数据置于昇腾AI处理器中
|
||||
# 将模型数据复制到昇腾AI处理器中
|
||||
model = model.to(CALCULATE_DEVICE)
|
||||
|
||||
optimizer = torch.optim.SGD([
|
||||
@@ -256,12 +245,12 @@ def main_worker(npu, args):
|
||||
args.lr)
|
||||
|
||||
# =========================================================================
|
||||
# 初始化混合精度模型,使用后可加速运算,但推理结果的准确率可能会轻微降低。可根据实际场景选择使用
|
||||
# 初始化混合精度模型,使用后可加速运算,但结果的准确率可能会轻微降低。可根据实际场景选择使用
|
||||
# =========================================================================
|
||||
model, optimizer = amp.initialize(model, optimizer, opt_level="O2", loss_scale=1024, verbosity=1)
|
||||
|
||||
# =========================================================================
|
||||
# 加载训练好的模型参数:通过命令行参数“--resume checkpoint文件”
|
||||
# 加载训练好的模型参数
|
||||
# =========================================================================
|
||||
# 从模型文件中恢复模型参数
|
||||
if os.path.isfile(args.resume):
|
||||
@@ -278,7 +267,7 @@ def main_worker(npu, args):
|
||||
print("=> no checkpoint found at '{}'".format(args.resume))
|
||||
|
||||
# =========================================================================
|
||||
# 初始化推理数据集
|
||||
# 初始化数据集
|
||||
# =========================================================================
|
||||
# 图像数据加载与预处理
|
||||
valdir = os.path.join(args.data, 'val')
|
||||
@@ -296,7 +285,7 @@ def main_worker(npu, args):
|
||||
num_workers=args.workers, pin_memory=True)
|
||||
|
||||
# =========================================================================
|
||||
# 进入在线推理模式
|
||||
# 运行validate
|
||||
# =========================================================================
|
||||
validate(val_loader, model, args)
|
||||
|
||||
@@ -332,7 +321,7 @@ def validate(val_loader, model, args):
|
||||
# 计算输出
|
||||
output = model(images)
|
||||
|
||||
# 测量结果精度
|
||||
# 统计结果精度
|
||||
acc1, acc5 = accuracy(output, target, topk=(1, 5))
|
||||
top1.update(acc1[0], images.size(0))
|
||||
top5.update(acc5[0], images.size(0))
|
||||
@@ -344,7 +333,6 @@ def validate(val_loader, model, args):
|
||||
# 打印推理运算过程日志
|
||||
progress.display(i)
|
||||
|
||||
# TODO: this should also be done with the ProgressMeter
|
||||
print(' * Acc@1 {top1.avg:.3f} Acc@5 {top5.avg:.3f}'.format(top1=top1, top5=top5))
|
||||
|
||||
return top1.avg
|
||||
@@ -380,7 +368,7 @@ class AverageMeter(object):
|
||||
|
||||
|
||||
class ProgressMeter(object):
|
||||
"""记录模型运算过程"""
|
||||
"""记录模型运算过程信息"""
|
||||
def __init__(self, num_batches, meters, prefix=""):
|
||||
self.batch_fmtstr = self._get_batch_fmtstr(num_batches)
|
||||
self.meters = meters
|
||||
@@ -418,13 +406,13 @@ if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
## 样例执行<a name="section340764716270"></a>
|
||||
#### 样例执行<a name="section340764716270"></a>
|
||||
|
||||
以ResNet50模型为例,执行在线推理样例。
|
||||
|
||||
1. 下载预训练模型。
|
||||
|
||||
打开ModelZoo中[ResNet50详情页](https://ascend.huawei.com/zh/#/software/modelzoo/detail/C/cf20ab8b8bea4032a6b056ab503112e4),点击该页面的“下载模型“下载已训练好的模型文件。
|
||||
打开ModelZoo中[ResNet50详情页](https://ascend.huawei.com/zh/#/software/modelzoo/detail/C/cf20ab8b8bea4032a6b056ab503112e4),单击该页面的“下载模型“下载已训练好的模型文件。
|
||||
|
||||
2. 编辑推理脚本。
|
||||
|
||||
@@ -432,41 +420,39 @@ if __name__ == '__main__':
|
||||
|
||||
3. 执行推理。
|
||||
|
||||
参考[环境变量配置](#环境变量配置.md)设置环境变量,并执行命令:
|
||||
参考[环境变量配置](#环境变量配置md)设置环境变量,并执行命令:
|
||||
|
||||
```
|
||||
python3.7 pytorch-resnet50-apex.py --data /data/imagenet --npu 7 --epochs 90 --resume checkpoint_npu7_epoch53.pth.tar
|
||||
# 参数'--resume'加载训练好的权重参数文件,用户可根据实际模型名称修改
|
||||
python3 pytorch-resnet50-apex.py --data /data/imagenet \
|
||||
--npu 7 \
|
||||
--epochs 90 \
|
||||
--resume ./checkpoint.pth.tar # ./checkpoint.pth.tar为示例预训练模型文件路径
|
||||
```
|
||||
|
||||
> **说明:**
|
||||
>上述为样例输入,用户可根据实际修改传入参数。
|
||||
|
||||
|
||||
<h2 id="专题.md">专题</h2>
|
||||
<h2 id="专题md">专题</h2>
|
||||
|
||||
- **[混合精度](#混合精度.md)**
|
||||
|
||||
- **[权重更新](#权重更新.md)**
|
||||
- **[混合精度](#混合精度md)**
|
||||
|
||||
|
||||
<h2 id="混合精度.md">混合精度</h2>
|
||||
<h3 id="混合精度md">混合精度</h3>
|
||||
|
||||
## 概述<a name="section14734122962615"></a>
|
||||
#### 概述<a name="section14734122962615"></a>
|
||||
|
||||
基于NPU芯片的架构特性,模型运算会涉及到混合精度,即混合使用float16和float32数据类型的应用场景。使用float16代替float32有如下好处:
|
||||
|
||||
●对于中间变量的内存占用更少,节省内存的使用。
|
||||
|
||||
●因内存使用会减少,所以数据传出的时间也会减半。
|
||||
|
||||
●float16的计算单元可以提供更快的计算性能。
|
||||
- 对于中间变量的内存占用更少,节省内存的使用。
|
||||
- 因内存使用会减少,所以数据传出的时间也会相应减少。
|
||||
- float16的计算单元可以提供更快的计算性能。
|
||||
|
||||
但是,混合精度训练受限于float16表达的精度范围,单纯将float32转换成float16会影响训练收敛情况,为了保证部分计算使用float16来进行加速的同时能保证训练收敛,这里采用混合精度模块Apex来达到以上效果。混合精度模块Apex是一个集优化性能、精度收敛于一身的综合优化库。
|
||||
|
||||
## 特性支持<a name="section175201458521"></a>
|
||||
#### 特性支持<a name="section175201458521"></a>
|
||||
|
||||
混合精度模块功能和优化描述如[表1](#zh-cn_topic_0278765773_table10717173813332)所示:
|
||||
混合精度模块功能和优化描述如[表1](#zh-cn_topic_0278765773_table10717173813332)所示。
|
||||
|
||||
**表 1** 混合精度模块功能
|
||||
|
||||
@@ -479,12 +465,12 @@ if __name__ == '__main__':
|
||||
</thead>
|
||||
<tbody><tr id="zh-cn_topic_0278765773_row1571763813334"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p4502732153412"><a name="zh-cn_topic_0278765773_p4502732153412"></a><a name="zh-cn_topic_0278765773_p4502732153412"></a>O1配置模式</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p640053920348"><a name="zh-cn_topic_0278765773_p640053920348"></a><a name="zh-cn_topic_0278765773_p640053920348"></a>Conv, Matmal等使用<span>float16</span>计算,其他如Softmax、BN使用<span>float32</span>。</p>
|
||||
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p640053920348"><a name="zh-cn_topic_0278765773_p640053920348"></a><a name="zh-cn_topic_0278765773_p640053920348"></a>Conv, Matmul等使用float16计算,其他如Softmax、BN使用float32。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0278765773_row3717173817336"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p11503103210344"><a name="zh-cn_topic_0278765773_p11503103210344"></a><a name="zh-cn_topic_0278765773_p11503103210344"></a>O2配置</p>
|
||||
<tr id="zh-cn_topic_0278765773_row3717173817336"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p11503103210344"><a name="zh-cn_topic_0278765773_p11503103210344"></a><a name="zh-cn_topic_0278765773_p11503103210344"></a>O2配置模式</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p164001639143419"><a name="zh-cn_topic_0278765773_p164001639143419"></a><a name="zh-cn_topic_0278765773_p164001639143419"></a>除了BN使用<span>float32</span>外,其他绝大部分使用<span>float16</span>。</p>
|
||||
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p164001639143419"><a name="zh-cn_topic_0278765773_p164001639143419"></a><a name="zh-cn_topic_0278765773_p164001639143419"></a>BN使用float32,其他绝大部分使用float16。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0278765773_row14717193815334"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p1950318328349"><a name="zh-cn_topic_0278765773_p1950318328349"></a><a name="zh-cn_topic_0278765773_p1950318328349"></a>静态Loss Scale功能</p>
|
||||
@@ -503,7 +489,7 @@ if __name__ == '__main__':
|
||||
> **说明:**
|
||||
>当前版本的实现方式主要为python实现,不支持AscendCL或者CUDA优化。
|
||||
|
||||
## 混合精度模型初始化<a name="section18178125518268"></a>
|
||||
#### 混合精度模型初始化<a name="section18178125518268"></a>
|
||||
|
||||
1. 使用apex混合精度模块需要首先从apex库中导入amp,代码如下:
|
||||
|
||||
@@ -517,114 +503,42 @@ if __name__ == '__main__':
|
||||
model, optimizer = amp.initialize(model, optimizer)
|
||||
```
|
||||
|
||||
- 可参考[样例代码](#样例参考.md)中的“初始化混合精度模型”:
|
||||
也可参考[样例代码](#样例参考md)中的“初始化混合精度模型”:
|
||||
|
||||
```
|
||||
model, optimizer = amp.initialize(model, optimizer, opt_level="O2", loss_scale=1024, verbosity=1)
|
||||
```
|
||||
```
|
||||
model, optimizer = amp.initialize(model, optimizer, opt_level="O2", loss_scale=1024, verbosity=1)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 混合精度推理<a name="section818071513288"></a>
|
||||
#### 混合精度推理<a name="section818071513288"></a>
|
||||
|
||||
按混合精度模型初始化后,正常执行模型正向计算即可。
|
||||
|
||||
参考代码:可参考[样例代码](#样例参考.md)实现。
|
||||
参考代码:可参考[样例代码](#样例参考md)实现。
|
||||
|
||||
<h2 id="权重更新.md">权重更新</h2>
|
||||
|
||||
## 背景<a name="section67167596290"></a>
|
||||
|
||||
推理进行的同时,训练服务器不断训练得到新的权重。
|
||||
|
||||
如果希望使用最新的权重进行推理,可以采用在线推理方式,直接更新权重。
|
||||
|
||||
## 整体流程<a name="section83461954103018"></a>
|
||||
|
||||
**图 1** 权重更新流程示意图<a name="fig6243201383"></a>
|
||||

|
||||
|
||||
如[图1](#fig6243201383)所示,支持循环地更新权重与执行推理。主要流程:
|
||||
|
||||
1. 模型初始化;
|
||||
2. 权重加载/更新:获取在线推理模型和权重信息,例如从ckpt文件中加载,实际更新用的权重则来自于外部的key-value;
|
||||
3. 加载数据;
|
||||
4. 执行推理图模型。
|
||||
|
||||
## 样例参考<a name="section95391544013"></a>
|
||||
|
||||
请参考[样例参考](#样例参考.md)。
|
||||
|
||||
<h2 id="FAQ.md">FAQ</h2>
|
||||
|
||||
- **[pip3.7 install Pillow==5.3.0安装失败](#pip3-7-install-Pillow-5-3-0安装失败.md)**
|
||||
|
||||
- **[安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配.md)**
|
||||
|
||||
|
||||
<h2 id="pip3-7-install-Pillow-5-3-0安装失败.md">pip3.7 install Pillow==5.3.0安装失败</h2>
|
||||
|
||||
## 现象描述<a name="zh-cn_topic_0277124533_zh-cn_topic_0175549220_section197270431505"></a>
|
||||
|
||||
pip3.7 install pillow==5.3.0安装失败。
|
||||
|
||||
## 可能原因<a name="zh-cn_topic_0277124533_zh-cn_topic_0175549220_section169499490501"></a>
|
||||
|
||||
缺少必要的依赖,如:libjpeg、python-devel、 zlib-devel 、libjpeg-turbo-devel等等。
|
||||
|
||||
## 处理方法<a name="zh-cn_topic_0277124533_section108142031907"></a>
|
||||
|
||||
安装相关依赖,通过如下命令安装:
|
||||
|
||||
- CentOS/EulerOS/Tlinux/BClinux/Suse
|
||||
|
||||
**yum install libjpeg python-devel zlib-devel libjpeg-turbo-devel**
|
||||
|
||||
- Ubuntu/Debian/UOS
|
||||
|
||||
**apt-get install libjpeg python-devel zlib-devel libjpeg-turbo-devel**
|
||||
|
||||
|
||||
<h2 id="安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配.md">安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配</h2>
|
||||
|
||||
## 现象描述<a name="zh-cn_topic_0277124535_zh-cn_topic_0175549220_section197270431505"></a>
|
||||
|
||||
安装“torch-\*.whl”时,提示"ERROR:torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible"。
|
||||
|
||||

|
||||
|
||||
## 可能原因<a name="zh-cn_topic_0277124535_zh-cn_topic_0175549220_section169499490501"></a>
|
||||
|
||||
安装torch时,会自动触发torchvision进行依赖版本检查,环境中安装的torchvision版本为0.6.0,检查时发现我们安装的torch-\*.whl的版本号与要求的1.5.0不一致,所以提示报错,但实际安装成功。
|
||||
|
||||
## 处理方法<a name="zh-cn_topic_0277124535_section108142031907"></a>
|
||||
|
||||
对实际结果无影响,无需处理。
|
||||
|
||||
<h2 id="安装7-3-0版本gcc.md">安装7.3.0版本gcc</h2>
|
||||
<h2 id="安装7-3-0版本gccmd">安装7.3.0版本gcc</h2>
|
||||
|
||||
以下步骤请在root用户下执行。
|
||||
|
||||
1. 下载gcc-7.3.0.tar.gz,下载地址为[https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz)。
|
||||
2. 安装gcc时候会占用大量临时空间,所以先执行下面的命令清空/tmp目录:
|
||||
2. 安装gcc时候会占用大量临时空间,请先执行下面的命令清空/tmp目录:
|
||||
|
||||
```
|
||||
sudo rm -rf /tmp/*
|
||||
```
|
||||
|
||||
3. 安装依赖。
|
||||
3. 安装依赖(以CentOS和Ubuntu系统为例)。
|
||||
- CentOS执行如下命令安装。
|
||||
|
||||
centos/bclinux执行如下命令安装。
|
||||
```
|
||||
yum install bzip2
|
||||
```
|
||||
|
||||
```
|
||||
yum install bzip2
|
||||
```
|
||||
- Ubuntu执行如下命令安装。
|
||||
|
||||
ubuntu/debian执行如下命令安装。
|
||||
|
||||
```
|
||||
apt-get install bzip2
|
||||
```
|
||||
```
|
||||
apt-get install bzip2
|
||||
```
|
||||
|
||||
4. 编译安装gcc。
|
||||
1. 进入gcc-7.3.0.tar.gz源码包所在目录,解压源码包,命令为:
|
||||
@@ -665,7 +579,7 @@ pip3.7 install pillow==5.3.0安装失败。
|
||||
make install
|
||||
```
|
||||
|
||||
> **注意:**
|
||||
> **须知:**
|
||||
>其中“--prefix“参数用于指定linux\_gcc7.3.0安装路径,用户可自行配置,但注意不要配置为“/usr/local“及“/usr“,因为会与系统使用软件源默认安装的gcc相冲突,导致系统原始gcc编译环境被破坏。示例指定为“/usr/local/linux\_gcc7.3.0“。
|
||||
|
||||
|
||||
@@ -677,7 +591,7 @@ pip3.7 install pillow==5.3.0安装失败。
|
||||
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
|
||||
```
|
||||
|
||||
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l75d31a2874534a2092e80a5f865b46f0)中配置的gcc7.3.0安装路径,本示例为“/usr/local/gcc7.3.0/“。
|
||||
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l75d31a2874534a2092e80a5f865b46f0)中配置的gcc7.3.0安装路径,本示例为“/usr/local/linux\_gcc7.3.0/“。
|
||||
|
||||
> **说明:**
|
||||
>本步骤为用户在需要用到gcc升级后的编译环境时才配置环境变量。
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
@@ -0,0 +1,555 @@
|
||||
# PyTorch安装指南
|
||||
- [简介](#简介md)
|
||||
- [手动编译安装](#手动编译安装md)
|
||||
- [前提条件](#前提条件md)
|
||||
- [安装PyTorch框架](#安装PyTorch框架md)
|
||||
- [配置环境变量](#配置环境变量md)
|
||||
- [安装混合精度模块](#安装混合精度模块md)
|
||||
- [参考信息](#参考信息md)
|
||||
- [CMake安装方法](#CMake安装方法md)
|
||||
- [安装7.3.0版本gcc](#安装7-3-0版本gccmd)
|
||||
- [安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md)
|
||||
<h2 id="简介md">简介</h2>
|
||||
|
||||
用户在准备相关环境进行基于PyTorch框架模型的开发、运行时,可以选择在服务器中手动编译安装PyTorch框架相关模块。
|
||||
|
||||
**图 1** 环境准备流程图<a name="zh-cn_topic_0000001119176876_fig1938918396117"></a>
|
||||
|
||||
|
||||

|
||||
|
||||
<h2 id="手动编译安装md">手动编译安装</h2>
|
||||
|
||||
- **[前提条件](#前提条件md)**
|
||||
|
||||
- **[安装PyTorch框架](#安装PyTorch框架md)**
|
||||
|
||||
- **[配置环境变量](#配置环境变量md)**
|
||||
|
||||
- **[安装混合精度模块](#安装混合精度模块md)**
|
||||
|
||||
|
||||
<h3 id="前提条件md">前提条件</h3>
|
||||
|
||||
#### 前提条件<a name="zh-cn_topic_0000001105856382_zh-cn_topic_0275872734_section108914373254"></a>
|
||||
|
||||
- 需完成CANN开发或运行环境的安装,具体操作请参考《CANN 软件安装指南》。
|
||||
- 需安装3.12.0以上版本的CMake,安装方法请参考[CMake安装方法](#CMake安装方法md)。
|
||||
- 需确保已安装7.3.0以上版本的gcc,7.3.0版本gcc具体安装及使用方式请参考[安装7.3.0版本gcc](#安装7-3-0版本gccmd)。
|
||||
- 需安装python版本为3.7.5或3.8。
|
||||
- 需确保环境中已安装patch、git工具,以Ubuntu和CentOS系统为例,命令如下:
|
||||
- Ubuntu系统
|
||||
|
||||
```
|
||||
apt-get install patch
|
||||
apt-get install git
|
||||
```
|
||||
|
||||
- CentOS系统
|
||||
|
||||
```
|
||||
yum install patch
|
||||
yum install git
|
||||
```
|
||||
|
||||
|
||||
|
||||
<h3 id="安装PyTorch框架md">安装PyTorch框架</h3>
|
||||
|
||||
#### 安装流程<a name="zh-cn_topic_0000001152776301_section1611810384557"></a>
|
||||
|
||||
1. 以root或非root用户登录服务器。
|
||||
2. 依次执行如下命令安装PyTorch依赖环境。
|
||||
|
||||
如果使用非root用户安装Python及其依赖,用户需要在本步骤中的每句命令结尾加上**--user**,命令示例为:**pip3.7 install pyyaml --user**
|
||||
|
||||
```
|
||||
pip3 install pyyaml
|
||||
pip3 install wheel
|
||||
```
|
||||
|
||||
3. 获取PyTorch源代码。
|
||||
|
||||
1. 运行如下命令,获取适配昇腾AI处理器的PyTorch源代码。
|
||||
|
||||
```
|
||||
git clone https://gitee.com/ascend/pytorch.git
|
||||
```
|
||||
|
||||
下载的源码主要目录结构如下所示:
|
||||
|
||||
```
|
||||
├── patch # 昇腾AI处理器适配补丁目录
|
||||
│ ├── pytorch1.5.0_npu.patch # pytorch1.5.0版本补丁
|
||||
│ └── pytorch1.8.1_npu.patch # pytorch1.8.1版本补丁
|
||||
├── pytorch1.5.0 # pytorch1.5.0源码及测试目录
|
||||
│ ├── access_control_test.py
|
||||
│ ├── src # 源码目录
|
||||
│ └── test # 测试用例存放目录
|
||||
├── pytorch1.8.1 # pytorch1.8.1源码及测试目录
|
||||
│ ├── access_control_test.py
|
||||
│ ├── src # 源码目录
|
||||
│ └── test # 测试用例存放目录
|
||||
└── scripts # 编译构建目录
|
||||
```
|
||||
|
||||
2. 在当前仓根目录“/pytorch“下获取原生PyTorch源代码。
|
||||
- 若安装pytorch1.5.0版本,执行如下命令。
|
||||
|
||||
```
|
||||
git clone -b v1.5.0 --depth=1 https://github.com/pytorch/pytorch.git
|
||||
```
|
||||
|
||||
- 若安装pytorch1.8.1版本,执行如下命令。
|
||||
|
||||
```
|
||||
git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
|
||||
```
|
||||
|
||||
3. 运行如下命令,进入原生pytorch代码目录“pytorch“,并获取PyTorch被动依赖代码。
|
||||
|
||||
```
|
||||
cd pytorch
|
||||
git submodule sync
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
> **说明:**
|
||||
>受网络波动影响,源码获取时间可能较长,下载过程中请耐心等待。 下载完成之后若没有报错,即生成了PyTorch及其依赖的第三方代码。
|
||||
|
||||
4. 编译生成适配昇腾AI处理器的PyTorch安装包。
|
||||
1. 进入“pytorch/scripts“文件夹,执行转换脚本,生成适配昇腾AI处理器的全量代码。
|
||||
|
||||
```
|
||||
cd ../scripts
|
||||
# 若安装1.5.0版本
|
||||
bash gen.sh
|
||||
# 若安装1.8.1版本
|
||||
bash gen.sh -v 1.8.1
|
||||
```
|
||||
|
||||
将在"pytorch/pytorch"目录中生成适配昇腾AI处理器的全量代码。
|
||||
|
||||
2. 进入到“pytorch/pytorch/“目录,依赖库安装。
|
||||
|
||||
```
|
||||
cd ../pytorch
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
3. 编译生成pytorch的二进制安装包。
|
||||
|
||||
```
|
||||
bash build.sh --python=3.7
|
||||
或
|
||||
bash build.sh --python=3.8
|
||||
```
|
||||
|
||||
请指定环境中python版本进行编译。生成的二进制包在当前的dist目录下,即“pytorch/pytorch/dist”文件夹目录下。
|
||||
|
||||
5. <a name="zh-cn_topic_0000001152776301_li49671667141"></a>安装PyTorch。
|
||||
|
||||
进入“pytorch/pytorch/dist“文件夹目录,执行如下命令安装。
|
||||
|
||||
```
|
||||
pip3 install --upgrade torch-1.5.0+ascend.post3-cp37-cp37m-linux_{arch}.whl
|
||||
```
|
||||
|
||||
**\{arch\}**表示架构信息,为aarch64或x86\_64。
|
||||
|
||||
> **说明:**
|
||||
>若对环境中的PyTorch进行升级时,需要先卸载环境中已安装的PyTorch软件包再执行[5. 安装PyTorch。](#zh-cn_topic_0000001152776301_li49671667141)可以通过执行如下命令查询环境上是否已安装PyTorch。
|
||||
>**pip3 list | grep torch**
|
||||
|
||||
|
||||
<h3 id="配置环境变量md">配置环境变量</h3>
|
||||
|
||||
安装完软件包后,需要配置环境变量才能正常使用昇腾PyTorch。相关环境变量介绍参见[表1](#zh-cn_topic_0000001152616261_table42017516135)。
|
||||
|
||||
1. 配置运行环境变量,在适配昇腾AI处理器的PyTorch源代码根目录中运行如下命令。
|
||||
|
||||
```
|
||||
source pytorch/env.sh
|
||||
```
|
||||
|
||||
2. 请依据实际场景,选择合适的HCCL初始化方式,并配置相应环境变量。
|
||||
|
||||
```
|
||||
# 场景一:单机场景
|
||||
export HCCL_WHITELIST_DISABLE=1 # 关闭HCCL通信白名单
|
||||
# 场景二:多机场景。
|
||||
export HCCL_WHITELIST_DISABLE=1 # 关闭HCCL通信白名单
|
||||
export HCCL_IF_IP="1.1.1.1" # “1.1.1.1”为示例使用的host网卡IP,请根据实际修改。需要保证使用的网卡IP在集群内是互通的。
|
||||
```
|
||||
|
||||
3. (可选)NPU场景下配置功能或性能环境变量。默认为不开启。
|
||||
|
||||
```
|
||||
export DYNAMIC_COMPILE_ENABLE=1 # 动态shape特性功能,针对shape变化场景,可选,开启设置为1(PyTorch1.8.1不支持该环境变量)
|
||||
export COMBINED_ENABLE=1 # 非连续两个算子组合类场景优化,可选,开启设置为1
|
||||
export TRI_COMBINED_ENABLE=1 # 非连续三个算子组合类场景优化,可选,开启设置为1
|
||||
export ACL_DUMP_DATA=1 # 算子数据dump功能,调试时使用,可选,开启设置为1
|
||||
export DYNAMIC_OP="ADD#MUL" # 算子实现,ADD和MUL算子在不同场景下有不同的性能表现。可选
|
||||
```
|
||||
|
||||
4. (可选)当系统为openEuler及其继承操作系统时,如UOS,需设置此命令,取消CPU绑核。
|
||||
|
||||
```
|
||||
# unset GOMP_CPU_AFFINITY
|
||||
```
|
||||
|
||||
|
||||
**表 1** 环境变量说明
|
||||
|
||||
<a name="zh-cn_topic_0000001152616261_table42017516135"></a>
|
||||
<table><thead align="left"><tr id="zh-cn_topic_0000001152616261_row16198951191317"><th class="cellrowborder" valign="top" width="55.48%" id="mcps1.2.3.1.1"><p id="zh-cn_topic_0000001152616261_p51981251161315"><a name="zh-cn_topic_0000001152616261_p51981251161315"></a><a name="zh-cn_topic_0000001152616261_p51981251161315"></a>配置项</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="44.519999999999996%" id="mcps1.2.3.1.2"><p id="zh-cn_topic_0000001152616261_p9198135114133"><a name="zh-cn_topic_0000001152616261_p9198135114133"></a><a name="zh-cn_topic_0000001152616261_p9198135114133"></a>说明</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="zh-cn_topic_0000001152616261_row6882121917329"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p688241953218"><a name="zh-cn_topic_0000001152616261_p688241953218"></a><a name="zh-cn_topic_0000001152616261_p688241953218"></a>LD_LIBRARY_PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p1888291915322"><a name="zh-cn_topic_0000001152616261_p1888291915322"></a><a name="zh-cn_topic_0000001152616261_p1888291915322"></a>动态库的查找路径,参考上述举例配置。</p>
|
||||
<p id="p1292181892120"><a name="p1292181892120"></a><a name="p1292181892120"></a>若训练所在系统环境需要升级gcc(例如CentOS、Debian和BClinux系统),则<span class="parmname" id="parmname795020446318"><a name="parmname795020446318"></a><a name="parmname795020446318"></a>“LD_LIBRARY_PATH”</span>配置项处动态库查找路径需要添加<span class="filepath" id="zh-cn_topic_0256062644_filepath115819811512"><a name="zh-cn_topic_0256062644_filepath115819811512"></a><a name="zh-cn_topic_0256062644_filepath115819811512"></a>“${install_path}/lib64”</span>,其中<span class="filepath" id="zh-cn_topic_0256062644_filepath195951574421"><a name="zh-cn_topic_0256062644_filepath195951574421"></a><a name="zh-cn_topic_0256062644_filepath195951574421"></a>“{install_path}”</span>为gcc升级安装路径。请参见<a href="#安装7-3-0版本gccmd#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li9745165315131">5</a>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row16194175523010"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p16195185523019"><a name="zh-cn_topic_0000001152616261_p16195185523019"></a><a name="zh-cn_topic_0000001152616261_p16195185523019"></a>PYTHONPATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p19637083322"><a name="zh-cn_topic_0000001152616261_p19637083322"></a><a name="zh-cn_topic_0000001152616261_p19637083322"></a>Python搜索路径,参考上述举例配置。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row2954102119329"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p195452113218"><a name="zh-cn_topic_0000001152616261_p195452113218"></a><a name="zh-cn_topic_0000001152616261_p195452113218"></a>PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p964914893211"><a name="zh-cn_topic_0000001152616261_p964914893211"></a><a name="zh-cn_topic_0000001152616261_p964914893211"></a>可执行程序的查找路径,参考上述举例配置。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row58592816294"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p1886016892913"><a name="zh-cn_topic_0000001152616261_p1886016892913"></a><a name="zh-cn_topic_0000001152616261_p1886016892913"></a>ASCEND_OPP_PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p28608892915"><a name="zh-cn_topic_0000001152616261_p28608892915"></a><a name="zh-cn_topic_0000001152616261_p28608892915"></a>算子根目录,参考上述举例配置。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row144592037903"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p104601373014"><a name="zh-cn_topic_0000001152616261_p104601373014"></a><a name="zh-cn_topic_0000001152616261_p104601373014"></a>OPTION_EXEC_EXTERN_PLUGIN_PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p1046013716017"><a name="zh-cn_topic_0000001152616261_p1046013716017"></a><a name="zh-cn_topic_0000001152616261_p1046013716017"></a>算子信息库路径。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row16184379493"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p131851873492"><a name="zh-cn_topic_0000001152616261_p131851873492"></a><a name="zh-cn_topic_0000001152616261_p131851873492"></a>ASCEND_AICPU_PATH</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p181851575497"><a name="zh-cn_topic_0000001152616261_p181851575497"></a><a name="zh-cn_topic_0000001152616261_p181851575497"></a>aicpu算子包路径。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row234714854615"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p2034724894619"><a name="zh-cn_topic_0000001152616261_p2034724894619"></a><a name="zh-cn_topic_0000001152616261_p2034724894619"></a>TASK_QUEUE_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p53477489462"><a name="zh-cn_topic_0000001152616261_p53477489462"></a><a name="zh-cn_topic_0000001152616261_p53477489462"></a>使用异步任务下发,异步调用acl接口。建议开启,开启设置为1。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row1680820246202"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p4809112415207"><a name="zh-cn_topic_0000001152616261_p4809112415207"></a><a name="zh-cn_topic_0000001152616261_p4809112415207"></a>HCCL_WHITELIST_DISABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p952814428206"><a name="zh-cn_topic_0000001152616261_p952814428206"></a><a name="zh-cn_topic_0000001152616261_p952814428206"></a>配置在使用HCCL时是否开启通信白名单。</p>
|
||||
<a name="ul928845132310"></a><a name="ul928845132310"></a><ul id="ul928845132310"><li>0:开启白名单,无需校验HCCL通信白名单。</li><li>1:关闭白名单,需校验HCCL通信白名单。</li></ul>
|
||||
<p id="zh-cn_topic_0000001152616261_p5809162416201"><a name="zh-cn_topic_0000001152616261_p5809162416201"></a><a name="zh-cn_topic_0000001152616261_p5809162416201"></a>缺省值为0,默认开启白名单。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row0671137162115"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p4671203792114"><a name="zh-cn_topic_0000001152616261_p4671203792114"></a><a name="zh-cn_topic_0000001152616261_p4671203792114"></a>HCCL_IF_IP</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p1822165982114"><a name="zh-cn_topic_0000001152616261_p1822165982114"></a><a name="zh-cn_topic_0000001152616261_p1822165982114"></a>配置HCCL的初始化通信网卡IP。</p>
|
||||
<a name="ul2676102292415"></a><a name="ul2676102292415"></a><ul id="ul2676102292415"><li>ip格式为点分十进制。</li><li>暂只支持host网卡。</li></ul>
|
||||
<p id="zh-cn_topic_0000001152616261_p1167163719217"><a name="zh-cn_topic_0000001152616261_p1167163719217"></a><a name="zh-cn_topic_0000001152616261_p1167163719217"></a>缺省时,按照以下优先级选定host通信网卡名:docker/local以外网卡(网卡名字字典序升序排列)>docker 网卡 > local网卡</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="zh-cn_topic_0000001152616261_row1371356152313"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p15106173103120"><a name="p15106173103120"></a><a name="p15106173103120"></a>PTCOPY_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p71055317311"><a name="p71055317311"></a><a name="p71055317311"></a>使用PTCopy算子模式,加速转连续及copy等过程,建议开启,开启设置为1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row743212132309"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p17433111312307"><a name="p17433111312307"></a><a name="p17433111312307"></a>ASCEND_SLOG_PRINT_TO_STDOUT</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p6433151393018"><a name="p6433151393018"></a><a name="p6433151393018"></a>(可选)设置是否开启日志打屏。</p>
|
||||
<a name="ul760201917473"></a><a name="ul760201917473"></a><ul id="ul760201917473"><li>0:表示采用日志的默认输出方式。</li><li>1:表示日志打屏显示。</li><li>其他值为非法值。</li></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row19237171814300"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p14238161893019"><a name="p14238161893019"></a><a name="p14238161893019"></a>ASCEND_GLOBAL_LOG_LEVEL</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p223841810303"><a name="p223841810303"></a><a name="p223841810303"></a>设置应用类日志的全局日志级别。</p>
|
||||
<a name="ul175714586453"></a><a name="ul175714586453"></a><ul id="ul175714586453"><li>0:对应DEBUG级别。</li><li>1:对应INFO级别。</li><li>2:对应WARNING级别。</li><li>3:对应ERROR级别。</li><li>4:对应NULL级别,不输出日志。</li><li>其他值为非法值。</li></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1348192313303"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p1734815235305"><a name="p1734815235305"></a><a name="p1734815235305"></a>ASCEND_GLOBAL_EVENT_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p12348202373018"><a name="p12348202373018"></a><a name="p12348202373018"></a>设置应用类日志是否开启Event日志。</p>
|
||||
<a name="ul416352114610"></a><a name="ul416352114610"></a><ul id="ul416352114610"><li>0:不开启Event日志。</li><li>1:开启Event日志。</li><li>其他值为非法值。</li></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17878184693015"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p1878194683016"><a name="p1878194683016"></a><a name="p1878194683016"></a>DYNAMIC_COMPILE_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p1887894620304"><a name="p1887894620304"></a><a name="p1887894620304"></a>(可选)动态shape特性功能,针对shape变化场景,开启设置为1(PyTorch1.8.1不支持该环境变量)。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row78312162301"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p1832171673019"><a name="p1832171673019"></a><a name="p1832171673019"></a>COMBINED_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p583261643014"><a name="p583261643014"></a><a name="p583261643014"></a>(可选)非连续两个算子组合类场景优化,开启设置为1。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17630155212342"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p66309527341"><a name="p66309527341"></a><a name="p66309527341"></a>RI_COMBINED_ENABLE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p19630185220345"><a name="p19630185220345"></a><a name="p19630185220345"></a>(可选)非连续三个算子组合类场景优化,开启设置为1。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row183041355123411"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p730435533415"><a name="p730435533415"></a><a name="p730435533415"></a>ACL_DUMP_DATA</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p16304105533412"><a name="p16304105533412"></a><a name="p16304105533412"></a>(可选)算子数据dump功能,调试时使用,开启设置为1。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row27481914203518"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p674813144357"><a name="p674813144357"></a><a name="p674813144357"></a>DYNAMIC_OP</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p974891414353"><a name="p974891414353"></a><a name="p974891414353"></a>(可选)算子实现,ADD和MUL算子在不同场景下有不同的性能表现。默认不设置。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row19173161510309"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p16711563237"><a name="zh-cn_topic_0000001152616261_p16711563237"></a><a name="zh-cn_topic_0000001152616261_p16711563237"></a>unset GOMP_CPU_AFFINITY</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p0711356152317"><a name="zh-cn_topic_0000001152616261_p0711356152317"></a><a name="zh-cn_topic_0000001152616261_p0711356152317"></a>(可选)当系统为openEuler及其继承操作系统时,如UOS,需设置此命令,取消CPU绑核。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3 id="安装混合精度模块md">安装混合精度模块</h3>
|
||||
|
||||
#### 前提条件<a name="zh-cn_topic_0000001106176190_section3225481020"></a>
|
||||
|
||||
1. 请确保运行环境中适配昇腾AI处理器的PyTorch框架能正常使用。
|
||||
2. 编译安装Apex前,需参见[配置环境变量](#配置环境变量md)配置好编译过程依赖的环境变量。
|
||||
|
||||
#### 安装流程<a name="zh-cn_topic_0000001106176190_section11880164819567"></a>
|
||||
|
||||
1. 以root或非root用户登录服务器。
|
||||
2. 获取apex源代码。
|
||||
|
||||
1. 运行如下命令,获取适配昇腾AI处理器的apex源代码。
|
||||
|
||||
```
|
||||
git clone https://gitee.com/ascend/apex.git
|
||||
```
|
||||
|
||||
下载的源码主要目录结构如下所示:
|
||||
|
||||
```
|
||||
apex
|
||||
│ ├─patch # 昇腾AI处理器适配补丁目录
|
||||
│ ├─npu.patch
|
||||
│ ├─scripts # 编译构建目录
|
||||
│ ├─gen.sh
|
||||
│ ├─src # 源码目录
|
||||
│ ├─tests # 测试用例存放目录
|
||||
```
|
||||
|
||||
2. 运行如下命令,进入“apex“目录,并获取原生apex源代码。
|
||||
|
||||
```
|
||||
cd apex
|
||||
git clone https://github.com/NVIDIA/apex.git
|
||||
```
|
||||
|
||||
下载原生apex源码后,代码主要目录结构如下所示:
|
||||
|
||||
```
|
||||
apex
|
||||
│ ├─apex # 原生apex代码目录
|
||||
│ ├─patch # 昇腾AI处理器适配补丁目录
|
||||
│ ├─npu.patch
|
||||
│ ├─scripts # 编译构建目录
|
||||
│ ├─gen.sh
|
||||
│ ├─src # 源码目录
|
||||
│ ├─tests # 测试用例存放目录
|
||||
```
|
||||
|
||||
3. 进入原生apex代码目录,即“apex/apex“目录。切换至commitid为4ef930c1c884fdca5f472ab2ce7cb9b505d26c1a的代码分支。
|
||||
|
||||
```
|
||||
cd apex
|
||||
git checkout 4ef930c1c884fdca5f472ab2ce7cb9b505d26c1a
|
||||
```
|
||||
|
||||
> **说明:**
|
||||
>受网络波动影响,源码获取时间可能较长,下载过程中请耐心等待。
|
||||
|
||||
3. 编译生成适配昇腾AI处理器的apex安装包。
|
||||
1. 进入“apex/scripts“文件夹,执行转换脚本,生成适配昇腾AI处理器的全量代码。
|
||||
|
||||
```
|
||||
cd ../scripts
|
||||
bash gen.sh
|
||||
```
|
||||
|
||||
将在"apex/apex"目录中生成适配昇腾AI处理器的全量代码。
|
||||
|
||||
2. 进入适配后的全量代码目录,即“apex/apex“目录,编译生成apex的二进制安装包。
|
||||
|
||||
```
|
||||
cd ../apex
|
||||
python3 setup.py --cpp_ext --npu_float_status bdist_wheel
|
||||
```
|
||||
|
||||
Python版本需与PyTorch使用的Python一致,生成的二进制包在当前的dist目录下,即“apex/apex/dist”文件夹目录下。
|
||||
|
||||
4. <a name="zh-cn_topic_0000001106176190_li425495374416"></a>安装apex。
|
||||
|
||||
进入“apex/apex/dist“文件夹目录,执行如下命令安装。
|
||||
|
||||
```
|
||||
pip3 install --upgrade apex-0.1+ascend-cp37-cp37m-linux_{arch}.whl
|
||||
```
|
||||
|
||||
**\{arch\}**表示架构信息,为aarch64或x86\_64。
|
||||
|
||||
> **说明:**
|
||||
>若对环境中的Apex进行升级时,需要先卸载环境中已安装的PyTorch软件包再执行[4. 安装apex。](#zh-cn_topic_0000001106176190_li425495374416)可以通过执行如下命令查询环境上是否已安装PyTorch。
|
||||
>**pip3 list | grep apex**
|
||||
|
||||
|
||||
<h2 id="参考信息md">参考信息</h2>
|
||||
|
||||
- **[CMake安装方法](#CMake安装方法md)**
|
||||
|
||||
- **[安装7.3.0版本gcc](#安装7-3-0版本gccmd)**
|
||||
|
||||
- **[安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md)**
|
||||
|
||||
|
||||
<h3 id="CMake安装方法md">CMake安装方法</h3>
|
||||
|
||||
CMake版本升级为3.12.1的方法
|
||||
|
||||
1. 获取Cmake软件包。
|
||||
|
||||
```
|
||||
wget https://cmake.org/files/v3.12/cmake-3.12.1.tar.gz --no-check-certificate
|
||||
```
|
||||
|
||||
2. 解压并进入软件包目录。
|
||||
|
||||
```
|
||||
tar -xf cmake-3.12.1.tar.gz
|
||||
cd cmake-3.12.1/
|
||||
```
|
||||
|
||||
3. 执行配置、编译和安装命令。
|
||||
|
||||
```
|
||||
./configure --prefix=/usr/local/cmake
|
||||
make && make install
|
||||
```
|
||||
|
||||
4. 设置软连接。
|
||||
|
||||
```
|
||||
ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
|
||||
```
|
||||
|
||||
5. 执行如下命令验证是否安装成功。
|
||||
|
||||
```
|
||||
cmake --version
|
||||
```
|
||||
|
||||
如显示“cmake version 3.12.1”则表示安装成功。
|
||||
|
||||
|
||||
<h3 id="安装7-3-0版本gccmd">安装7.3.0版本gcc</h3>
|
||||
|
||||
以下步骤请在root用户下执行。
|
||||
|
||||
1. 下载gcc-7.3.0.tar.gz,下载地址为[https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz)。
|
||||
2. 安装gcc时候会占用大量临时空间,所以先执行下面的命令清空/tmp目录:
|
||||
|
||||
```
|
||||
sudo rm -rf /tmp/*
|
||||
```
|
||||
|
||||
3. 安装依赖(以CentOS和Ubuntu系统为例)。
|
||||
- CentOS执行如下命令安装。
|
||||
|
||||
```
|
||||
yum install bzip2
|
||||
```
|
||||
|
||||
- Ubuntu执行如下命令安装。
|
||||
|
||||
```
|
||||
apt-get install bzip2
|
||||
```
|
||||
|
||||
4. 编译安装gcc。
|
||||
1. 进入gcc-7.3.0.tar.gz源码包所在目录,解压源码包,命令为:
|
||||
|
||||
```
|
||||
tar -zxvf gcc-7.3.0.tar.gz
|
||||
```
|
||||
|
||||
2. 进入解压后的文件夹,执行如下命令下载gcc依赖包:
|
||||
|
||||
```
|
||||
cd gcc-7.3.0
|
||||
./contrib/download_prerequisites
|
||||
```
|
||||
|
||||
如果执行上述命令报错,需要执行如下命令在“gcc-7.3.0/“文件夹下下载依赖包:
|
||||
|
||||
```
|
||||
wget http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
|
||||
wget http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
|
||||
wget http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
|
||||
wget http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2
|
||||
```
|
||||
|
||||
下载好上述依赖包后,重新执行以下命令:
|
||||
|
||||
```
|
||||
./contrib/download_prerequisites
|
||||
```
|
||||
|
||||
如果上述命令校验失败,需要确保依赖包为一次性下载成功,无重复下载现象。
|
||||
|
||||
3. <a name="zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310"></a>执行配置、编译和安装命令:
|
||||
|
||||
```
|
||||
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/linux_gcc7.3.0
|
||||
make -j15 # 通过grep -w processor /proc/cpuinfo|wc -l查看cpu数,示例为15,用户可自行设置相应参数。
|
||||
make install
|
||||
```
|
||||
|
||||
> **须知:**
|
||||
>其中“--prefix“参数用于指定linux\_gcc7.3.0安装路径,用户可自行配置,但注意不要配置为“/usr/local“及“/usr“,因为会与系统使用软件源默认安装的gcc相冲突,导致系统原始gcc编译环境被破坏。示例指定为“/usr/local/linux\_gcc7.3.0“。
|
||||
|
||||
|
||||
5. 配置环境变量。
|
||||
|
||||
当用户执行训练时,需要用到gcc升级后的编译环境,因此要在训练脚本中配置环境变量,通过如下命令配置。
|
||||
|
||||
```
|
||||
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
|
||||
```
|
||||
|
||||
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310)中配置的gcc7.3.0安装路径,本示例为“/usr/local/gcc7.3.0/“。
|
||||
|
||||
> **说明:**
|
||||
>本步骤为用户在需要用到gcc升级后的编译环境时才配置环境变量。
|
||||
|
||||
|
||||
<h3 id="安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md">安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配</h3>
|
||||
|
||||
#### 现象描述<a name="zh-cn_topic_0000001105856364_zh-cn_topic_0175549220_section197270431505"></a>
|
||||
|
||||
安装“torch-\*.whl”时,提示"ERROR:torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible"。
|
||||
|
||||

|
||||
|
||||
#### 可能原因<a name="zh-cn_topic_0000001105856364_zh-cn_topic_0175549220_section169499490501"></a>
|
||||
|
||||
安装torch时,会自动触发torchvision进行依赖版本检查,环境中安装的torchvision版本为0.6.0,检查时发现我们安装的torch-\*.whl的版本号与要求的1.5.0不一致,所以提示报错,但实际安装成功 。
|
||||
|
||||
#### 处理方法<a name="zh-cn_topic_0000001105856364_section108142031907"></a>
|
||||
|
||||
对实际结果无影响,无需处理。
|
||||
|
||||
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 394 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 946 B After Width: | Height: | Size: 946 B |
|
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 356 B |
|
Before Width: | Height: | Size: 946 B After Width: | Height: | Size: 946 B |
|
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 356 B |
|
After Width: | Height: | Size: 329 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 394 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 580 B |
@@ -0,0 +1,242 @@
|
||||
# FrameworkPTAdapter 2.0.3 版本说明书
|
||||
- [用户须知](#用户须知md)
|
||||
- [新增特性](#新增特性md)
|
||||
- [特性修改](#特性修改md)
|
||||
- [已修复问题](#已修复问题md)
|
||||
- [已知问题](#已知问题md)
|
||||
- [兼容性](#兼容性md)
|
||||
<h2 id='用户须知md'>用户须知</h2>
|
||||
|
||||
本框架基于Facebook主导的开源PyTorch1.5.0进行修改,延续原生的PyTorch特性,使用NPU进行动态图训练;以算子粒度进行模型适配,代码重用性好,支持现有的网络只修改设备类型或数据类型,即可迁移到NPU上使用。
|
||||
|
||||
从此版本开始,PyTorch1.8.1版本提供支持,此版本延续PyTorch1.5.0特性,功能保持一致(profiling工具除外)。除此之外,对后端算子适配提供较好开发体验。当期1.8.1版本仅支持Resent50网络模型。
|
||||
|
||||
<h2 id='新增特性md'>新增特性</h2>
|
||||
|
||||
**表 1** PyTorch支持的版本特性列表
|
||||
|
||||
<a name="t76c34275cbb74753970f7c5a9eb594fa"></a>
|
||||
|
||||
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.459999999999999%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>一级特性</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="26.27%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>二级特性</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="63.27%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>说明</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row7979351559"><td class="cellrowborder" rowspan="5" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>适配NPU的PyTorch特性</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>支持PyTorch1.8.1版本</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>增加PyTorch1.8.1版本, 当前仅支持resnet50网络,包括其DDP分布式训练场景。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>支持python3.8</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>支持python3.8环境编译及使用。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>提供算子溢出检测工具</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>支持框架IR级别算子溢出检测,在发生AICORE算子溢出时,提示溢出的IR信息。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row185381431133610"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p953883153611"><a name="p953883153611"></a><a name="p953883153611"></a>OS兼容性</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p13538203153618"><a name="p13538203153618"></a><a name="p13538203153618"></a>新增支持UOS 20 1020e arm系统</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row91681125173610"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p2168172519364"><a name="p2168172519364"></a><a name="p2168172519364"></a>框架基础功能</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1416815259367"><a name="p1416815259367"></a><a name="p1416815259367"></a>新增适配算子开发(详见算子清单)</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row11970351050"><td class="cellrowborder" rowspan="26" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p298314333514"><a name="p298314333514"></a><a name="p298314333514"></a>训练模型</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p19984193312511"><a name="p19984193312511"></a><a name="p19984193312511"></a>CenterFace</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p7517351258"><a name="p7517351258"></a><a name="p7517351258"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row9965351254"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1984033458"><a name="p1984033458"></a><a name="p1984033458"></a>PCBU</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p298411338513"><a name="p298411338513"></a><a name="p298411338513"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row14966351959"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p198414331957"><a name="p198414331957"></a><a name="p198414331957"></a>Net++</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1798413331756"><a name="p1798413331756"></a><a name="p1798413331756"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row20966351454"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p4984183317518"><a name="p4984183317518"></a><a name="p4984183317518"></a>FCN8S</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1698453311519"><a name="p1698453311519"></a><a name="p1698453311519"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row19653517518"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1298483319512"><a name="p1298483319512"></a><a name="p1298483319512"></a>OSNetRetinaFace</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1798423312519"><a name="p1798423312519"></a><a name="p1798423312519"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row39619351751"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1298414331513"><a name="p1298414331513"></a><a name="p1298414331513"></a>PSPnet</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p10984633254"><a name="p10984633254"></a><a name="p10984633254"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row496335654"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19984433351"><a name="p19984433351"></a><a name="p19984433351"></a>EDSR</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p898473314517"><a name="p898473314517"></a><a name="p898473314517"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17953357517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p14984123312515"><a name="p14984123312515"></a><a name="p14984123312515"></a>Tsm</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p159841033855"><a name="p159841033855"></a><a name="p159841033855"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row16951435551"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19984933457"><a name="p19984933457"></a><a name="p19984933457"></a>pnasnet5large</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p89846335512"><a name="p89846335512"></a><a name="p89846335512"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row2095113520514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1798416331952"><a name="p1798416331952"></a><a name="p1798416331952"></a>Gaitset</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p098417336516"><a name="p098417336516"></a><a name="p098417336516"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row89516351511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p11985153312516"><a name="p11985153312516"></a><a name="p11985153312516"></a>fcn</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p169858331155"><a name="p169858331155"></a><a name="p169858331155"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row5953353513"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18985103311514"><a name="p18985103311514"></a><a name="p18985103311514"></a>Albert</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p2098513334519"><a name="p2098513334519"></a><a name="p2098513334519"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row119533516513"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p598511336511"><a name="p598511336511"></a><a name="p598511336511"></a>AdvancedEast</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p119850331513"><a name="p119850331513"></a><a name="p119850331513"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row39511356512"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p698553311512"><a name="p698553311512"></a><a name="p698553311512"></a>ReidStrongBaseline</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1198514331659"><a name="p1198514331659"></a><a name="p1198514331659"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row129463518517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p99851633158"><a name="p99851633158"></a><a name="p99851633158"></a>Fast-scnn</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1298514331359"><a name="p1298514331359"></a><a name="p1298514331359"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row9942035757"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p109854331151"><a name="p109854331151"></a><a name="p109854331151"></a>RDN</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1198583317511"><a name="p1198583317511"></a><a name="p1198583317511"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row79415357517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6985833351"><a name="p6985833351"></a><a name="p6985833351"></a>SRFlow</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p29851033350"><a name="p29851033350"></a><a name="p29851033350"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row12947357514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p149859334518"><a name="p149859334518"></a><a name="p149859334518"></a>MGN</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p19851833850"><a name="p19851833850"></a><a name="p19851833850"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row3941735855"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p898533316518"><a name="p898533316518"></a><a name="p898533316518"></a>Roberta</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p998553318518"><a name="p998553318518"></a><a name="p998553318518"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1093335856"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1985533451"><a name="p1985533451"></a><a name="p1985533451"></a>RegNetY</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p59851033355"><a name="p59851033355"></a><a name="p59851033355"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row49373518516"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19986173311512"><a name="p19986173311512"></a><a name="p19986173311512"></a>VoVNet-39</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p798683310515"><a name="p798683310515"></a><a name="p798683310515"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row5930351357"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p189862336515"><a name="p189862336515"></a><a name="p189862336515"></a>RegNetX</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1398618331651"><a name="p1398618331651"></a><a name="p1398618331651"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row169312351655"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p149863337513"><a name="p149863337513"></a><a name="p149863337513"></a>RefineNet</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p2098615331959"><a name="p2098615331959"></a><a name="p2098615331959"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row11931235957"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1198616331657"><a name="p1198616331657"></a><a name="p1198616331657"></a>RefineDet</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1698611332518"><a name="p1698611332518"></a><a name="p1698611332518"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row189215359511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p16986183319512"><a name="p16986183319512"></a><a name="p16986183319512"></a>AlignedReID</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1898715331055"><a name="p1898715331055"></a><a name="p1898715331055"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row89213351858"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p119878330511"><a name="p119878330511"></a><a name="p119878330511"></a>FaceBoxes</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p129878331158"><a name="p129878331158"></a><a name="p129878331158"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="特性修改md">特性修改</h2>
|
||||
|
||||
不涉及
|
||||
|
||||
<h2 id="已修复问题md">已修复问题</h2>
|
||||
|
||||
不涉及
|
||||
|
||||
<h2 id="已知问题md">已知问题</h2>
|
||||
|
||||
<a name="table1969972073016"></a>
|
||||
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>已知问题</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>问题描述</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>数据类型支持</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPU不支持float16类型的inf/nan数据输入输出。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>数据Format</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>出现4D以上的format时不能降维。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>集合通信约束</p>
|
||||
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>要求一次训练任务中不同device上执行的图相同。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>当前只支持1/2/4/8P粒度的分配。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>只支持int8,int32,float16和float32数据类型。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex功能支持</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>Apex当前版本的实现方式主要为python实现,不支持APEX中的自定义优化CUDA Kernel。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="兼容性md">兼容性</h2>
|
||||
|
||||
A800-9010:CentOS 7.6/Ubuntu 18.04/BC-Linux 7.6/Debian 9.9/Debian 10/OpenEuler 20.03 LTS
|
||||
|
||||
A800-9000:CentOS 7.6/Euler 2.8/Kylin v10/BC-Linux 7.6/OpenEuler 20.03 LTS/UOS 20 1020e
|
||||
|
||||
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 394 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 580 B |
|
After Width: | Height: | Size: 394 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 580 B |
@@ -1,3 +1,17 @@
|
||||
# Copyright (c) 2020 Huawei Technologies Co., Ltd
|
||||
# All rights reserved.
|
||||
#
|
||||
# Licensed under the BSD 3-Clause License (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://opensource.org/licenses/BSD-3-Clause
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
import os
|
||||
@@ -980,6 +980,8 @@
|
||||
NPU: conv_transpose2d_npu_
|
||||
|
||||
- func: conv_transpose3d.input(Tensor input, Tensor weight, Tensor? bias=None, int[3] stride=1, int[3] padding=0, int[3] output_padding=0, int groups=1, int[3] dilation=1) -> Tensor
|
||||
npu_dispatch:
|
||||
NPU: conv_transpose3d_npu_
|
||||
|
||||
- func: copy_(Tensor(a!) self, Tensor src, bool non_blocking=False) -> Tensor(a!)
|
||||
manual_kernel_registration: True
|
||||
@@ -1112,11 +1114,19 @@
|
||||
|
||||
- func: npu_conv_transpose2d(Tensor input, Tensor weight, Tensor? bias, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups) -> Tensor
|
||||
npu_dispatch_only:
|
||||
NPU: convolution_transpose_npu
|
||||
NPU: conv_transpose2d_npu
|
||||
|
||||
- func: npu_convolution_transpose_backward(Tensor input, Tensor grad_output, Tensor weight, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
|
||||
npu_dispatch_only:
|
||||
NPU: convolution_transpose_backward_npu
|
||||
NPU: npu_convolution_transpose_backward
|
||||
|
||||
- func: npu_conv_transpose2d_backward(Tensor input, Tensor grad_output, Tensor weight, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
|
||||
npu_dispatch_only:
|
||||
NPU: conv_transpose2d_backward_npu
|
||||
|
||||
- func: npu_conv_transpose3d_backward(Tensor input, Tensor grad_output, Tensor weight, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
|
||||
npu_dispatch_only:
|
||||
NPU: conv_transpose3d_backward_npu
|
||||
|
||||
- func: npu_convolution(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, int groups) -> Tensor
|
||||
npu_dispatch_only:
|
||||
@@ -1126,6 +1136,10 @@
|
||||
npu_dispatch_only:
|
||||
NPU: npu_convolution_backward
|
||||
|
||||
- func: npu_convolution_double_backward(Tensor? ggI, Tensor? ggW, Tensor? ggb, Tensor input, Tensor gO, Tensor weight, int[] stride, int[] padding, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
|
||||
npu_dispatch_only:
|
||||
NPU: npu_convolution_double_backward
|
||||
|
||||
- func: npu_conv2d(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, int groups) -> Tensor
|
||||
npu_dispatch_only:
|
||||
NPU: conv2d_npu
|
||||
@@ -1179,34 +1193,30 @@
|
||||
dispatch:
|
||||
CPU: cummax_helper_cpu
|
||||
CUDA: cummax_helper_cuda
|
||||
npu_dispatch:
|
||||
NPU: cummax_helper_npu
|
||||
|
||||
- func: cummin(Tensor self, int dim) -> (Tensor values, Tensor indices)
|
||||
supports_named_tensor: True
|
||||
variants: function, method
|
||||
npu_dispatch:
|
||||
NPU: cummin_npu
|
||||
|
||||
- func: cummin.out(Tensor self, int dim, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)
|
||||
supports_named_tensor: True
|
||||
npu_dispatch:
|
||||
NPU: cummin_out_npu
|
||||
|
||||
- func: cummin.dimname(Tensor self, Dimname dim) -> (Tensor values, Tensor indices)
|
||||
supports_named_tensor: True
|
||||
variants: function, method
|
||||
npu_dispatch:
|
||||
NPU: cummin_npu
|
||||
|
||||
- func: cummin.dimname_out(Tensor self, Dimname dim, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)
|
||||
supports_named_tensor: True
|
||||
npu_dispatch:
|
||||
NPU: cummin_out_npu
|
||||
|
||||
- func: _cummin_helper(Tensor self, Tensor(a!) values, Tensor(b!) indices, int dim) -> ()
|
||||
variants: function
|
||||
dispatch:
|
||||
CPU: cummin_helper_cpu
|
||||
CUDA: cummin_helper_cuda
|
||||
npu_dispatch:
|
||||
NPU: cummin_helper_npu
|
||||
|
||||
- func: cumprod(Tensor self, int dim, *, ScalarType? dtype=None) -> Tensor
|
||||
supports_named_tensor: True
|
||||
@@ -1508,6 +1518,8 @@
|
||||
use_c10_dispatcher: full
|
||||
supports_named_tensor: True
|
||||
variants: function, method
|
||||
npu_dispatch:
|
||||
NPU: erfc_npu
|
||||
|
||||
- func: erfc_(Tensor(a!) self) -> Tensor(a!)
|
||||
supports_named_tensor: True
|
||||
@@ -1515,12 +1527,16 @@
|
||||
dispatch:
|
||||
CPU: _erfc__cpu
|
||||
CUDA: _erfc__cuda
|
||||
npu_dispatch:
|
||||
NPU: erfc_npu_
|
||||
|
||||
- func: erfc.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
||||
supports_named_tensor: True
|
||||
dispatch:
|
||||
CPU: _erfc_out_cpu
|
||||
CUDA: _erfc_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: erfc_out_npu
|
||||
|
||||
- func: exp(Tensor self) -> Tensor
|
||||
use_c10_dispatcher: full
|
||||
@@ -2627,14 +2643,20 @@
|
||||
- func: batch_norm_stats(Tensor input, float eps) -> (Tensor, Tensor)
|
||||
dispatch:
|
||||
CUDA: batch_norm_stats_cuda
|
||||
npu_dispatch:
|
||||
NPU: batch_norm_stats_npu
|
||||
|
||||
- func: batch_norm_elemt(Tensor input, Tensor? weight, Tensor? bias, Tensor mean, Tensor invstd, float eps) -> Tensor
|
||||
dispatch:
|
||||
CUDA: batch_norm_elemt_cuda
|
||||
npu_dispatch:
|
||||
NPU: batch_norm_elemt_npu
|
||||
|
||||
- func: batch_norm_elemt.out(Tensor input, Tensor? weight, Tensor? bias, Tensor mean, Tensor invstd, float eps, *, Tensor(a!) out) -> Tensor(a!)
|
||||
dispatch:
|
||||
CUDA: batch_norm_elemt_cuda_out
|
||||
npu_dispatch:
|
||||
NPU: batch_norm_elemt_out_npu
|
||||
|
||||
# for backward compatibility
|
||||
- func: batch_norm_gather_stats(Tensor input, Tensor mean, Tensor invstd, Tensor? running_mean, Tensor? running_var, float momentum, float eps, int count) -> (Tensor, Tensor)
|
||||
@@ -2655,6 +2677,8 @@
|
||||
- func: batch_norm_backward_reduce(Tensor grad_out, Tensor input, Tensor mean, Tensor invstd, Tensor? weight, bool input_g, bool weight_g, bool bias_g) -> (Tensor, Tensor, Tensor, Tensor)
|
||||
dispatch:
|
||||
CUDA: batch_norm_backward_reduce_cuda
|
||||
npu_dispatch:
|
||||
NPU: batch_norm_backward_reduce_npu
|
||||
|
||||
- func: batch_norm_backward_elemt(Tensor grad_out, Tensor input, Tensor mean, Tensor invstd, Tensor? weight, Tensor mean_dy, Tensor mean_dy_xmu) -> Tensor
|
||||
dispatch:
|
||||
@@ -5154,6 +5178,8 @@
|
||||
dispatch:
|
||||
CPU: __lshift__
|
||||
CUDA: __lshift__
|
||||
npu_dispatch:
|
||||
NPU: __lshift___npu
|
||||
|
||||
- func: __lshift__.Tensor(Tensor self, Tensor other) -> Tensor
|
||||
use_c10_dispatcher: full
|
||||
@@ -5161,18 +5187,24 @@
|
||||
dispatch:
|
||||
CPU: __lshift__
|
||||
CUDA: __lshift__
|
||||
npu_dispatch:
|
||||
NPU: __lshift___npu
|
||||
|
||||
- func: __ilshift__.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)
|
||||
variants: method
|
||||
dispatch:
|
||||
CPU: __ilshift__
|
||||
CUDA: __ilshift__
|
||||
npu_dispatch:
|
||||
NPU: __iLshift___npu
|
||||
|
||||
- func: __ilshift__.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)
|
||||
variants: method
|
||||
dispatch:
|
||||
CPU: __ilshift__
|
||||
CUDA: __ilshift__
|
||||
npu_dispatch:
|
||||
NPU: __iLshift___npu
|
||||
|
||||
- func: __rshift__.Scalar(Tensor self, Scalar other) -> Tensor
|
||||
use_c10_dispatcher: full
|
||||
@@ -5180,6 +5212,8 @@
|
||||
dispatch:
|
||||
CPU: __rshift__
|
||||
CUDA: __rshift__
|
||||
npu_dispatch:
|
||||
NPU: __rshift___npu
|
||||
|
||||
- func: __rshift__.Tensor(Tensor self, Tensor other) -> Tensor
|
||||
use_c10_dispatcher: full
|
||||
@@ -5187,18 +5221,24 @@
|
||||
dispatch:
|
||||
CPU: __rshift__
|
||||
CUDA: __rshift__
|
||||
npu_dispatch:
|
||||
NPU: __rshift___npu
|
||||
|
||||
- func: __irshift__.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)
|
||||
variants: method
|
||||
dispatch:
|
||||
CPU: __irshift__
|
||||
CUDA: __irshift__
|
||||
npu_dispatch:
|
||||
NPU: __iRshift___npu
|
||||
|
||||
- func: __irshift__.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)
|
||||
variants: method
|
||||
dispatch:
|
||||
CPU: __irshift__
|
||||
CUDA: __irshift__
|
||||
npu_dispatch:
|
||||
NPU: __iRshift___npu
|
||||
|
||||
- func: lgamma_(Tensor(a!) self) -> Tensor(a!)
|
||||
supports_named_tensor: True
|
||||
@@ -5442,11 +5482,15 @@
|
||||
dispatch:
|
||||
CPU: tril_indices_cpu
|
||||
CUDA: tril_indices_cuda
|
||||
npu_dispatch:
|
||||
NPU: tril_indices_npu
|
||||
|
||||
- func: triu_indices(int row, int col, int offset=0, *, ScalarType? dtype=long, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
||||
dispatch:
|
||||
CPU: triu_indices_cpu
|
||||
CUDA: triu_indices_cuda
|
||||
npu_dispatch:
|
||||
NPU: triu_indices_npu
|
||||
|
||||
- func: trace(Tensor self) -> Tensor
|
||||
use_c10_dispatcher: full
|
||||
@@ -5856,6 +5900,8 @@
|
||||
dispatch:
|
||||
CPU: _triangular_solve_helper_cpu
|
||||
CUDA: _triangular_solve_helper_cuda
|
||||
npu_dispatch:
|
||||
NPU: _triangular_solve_helper_npu
|
||||
|
||||
- func: symeig.e(Tensor self, bool eigenvectors=False, bool upper=True, *, Tensor(a!) e, Tensor(b!) V) -> (Tensor(a!) eigenvalues, Tensor(b!) eigenvectors)
|
||||
|
||||
@@ -5867,6 +5913,8 @@
|
||||
dispatch:
|
||||
CPU: _symeig_helper_cpu
|
||||
CUDA: _symeig_helper_cuda
|
||||
npu_dispatch:
|
||||
NPU: _symeig_helper_npu
|
||||
|
||||
- func: eig.e(Tensor self, bool eigenvectors=False, *, Tensor(a!) e, Tensor(b!) v) -> (Tensor(a!) eigenvalues, Tensor(b!) eigenvectors)
|
||||
dispatch:
|
||||
@@ -5889,6 +5937,8 @@
|
||||
dispatch:
|
||||
CPU: _svd_helper_cpu
|
||||
CUDA: _svd_helper_cuda
|
||||
npu_dispatch:
|
||||
NPU: _svd_helper_npu
|
||||
|
||||
- func: cholesky.out(Tensor self, bool upper=False, *, Tensor(a!) out) -> Tensor(a!)
|
||||
|
||||
@@ -7118,22 +7168,30 @@
|
||||
dispatch:
|
||||
CPU: rrelu_with_noise_out_cpu
|
||||
CUDA: legacy::cuda::_thnn_rrelu_with_noise_forward_out
|
||||
npu_dispatch:
|
||||
NPU: rrelu_with_noise_out_npu
|
||||
|
||||
- func: rrelu_with_noise(Tensor self, Tensor noise, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=False, Generator? generator=None) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: rrelu_with_noise_cpu
|
||||
CUDA: legacy::cuda::_thnn_rrelu_with_noise_forward
|
||||
npu_dispatch:
|
||||
NPU: rrelu_with_noise_npu
|
||||
|
||||
- func: rrelu_with_noise_backward(Tensor grad_output, Tensor self, Tensor noise, Scalar lower, Scalar upper, bool training, bool self_is_result) -> Tensor
|
||||
use_c10_dispatcher: full
|
||||
python_module: nn
|
||||
npu_dispatch:
|
||||
NPU: rrelu_with_noise_backward_npu
|
||||
|
||||
- func: rrelu_with_noise_(Tensor(a!) self, Tensor noise, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=False, Generator? generator=None) -> Tensor(a!)
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: rrelu_with_noise_cpu_
|
||||
CUDA: legacy::cuda::_thnn_rrelu_with_noise_forward_
|
||||
npu_dispatch:
|
||||
NPU: rrelu_with_noise_npu_
|
||||
|
||||
- func: softplus.out(Tensor self, Scalar beta=1, Scalar threshold=20, *, Tensor(a!) out) -> Tensor(a!)
|
||||
python_module: nn
|
||||
@@ -7512,48 +7570,64 @@
|
||||
dispatch:
|
||||
CPU: max_unpooling2d_forward_out_cpu
|
||||
CUDA: max_unpooling2d_forward_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool2d_out_npu
|
||||
|
||||
- func: max_unpool2d(Tensor self, Tensor indices, int[2] output_size) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling2d_forward_cpu
|
||||
CUDA: max_unpooling2d_forward_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool2d_npu
|
||||
|
||||
- func: max_unpool2d_backward.grad_input(Tensor grad_output, Tensor self, Tensor indices, int[2] output_size, *, Tensor(a!) grad_input) -> Tensor(a!)
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling2d_backward_out_cpu
|
||||
CUDA: max_unpooling2d_backward_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool2d_backward_out_npu
|
||||
|
||||
- func: max_unpool2d_backward(Tensor grad_output, Tensor self, Tensor indices, int[2] output_size) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling2d_backward_cpu
|
||||
CUDA: max_unpooling2d_backward_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool2d_backward_npu
|
||||
|
||||
- func: max_unpool3d.out(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) out) -> Tensor(a!)
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling3d_forward_out_cpu
|
||||
CUDA: max_unpooling3d_forward_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool3d_out_npu
|
||||
|
||||
- func: max_unpool3d(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling3d_forward_cpu
|
||||
CUDA: max_unpooling3d_forward_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool3d_npu
|
||||
|
||||
- func: max_unpool3d_backward.grad_input(Tensor grad_output, Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling3d_backward_out_cpu
|
||||
CUDA: max_unpooling3d_backward_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool3d_backward_out_npu
|
||||
|
||||
- func: max_unpool3d_backward(Tensor grad_output, Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: max_unpooling3d_backward_cpu
|
||||
CUDA: max_unpooling3d_backward_cuda
|
||||
npu_dispatch:
|
||||
NPU: max_unpool3d_backward_npu
|
||||
|
||||
- func: reflection_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)
|
||||
python_module: nn
|
||||
@@ -7600,12 +7674,16 @@
|
||||
dispatch:
|
||||
CPU: reflection_pad2d_backward_out_cpu
|
||||
CUDA: reflection_pad2d_backward_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: reflection_pad2d_backward_out_npu
|
||||
|
||||
- func: reflection_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: reflection_pad2d_backward_cpu
|
||||
CUDA: reflection_pad2d_backward_cuda
|
||||
npu_dispatch:
|
||||
NPU: reflection_pad2d_backward_npu
|
||||
|
||||
- func: replication_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)
|
||||
python_module: nn
|
||||
@@ -7652,12 +7730,16 @@
|
||||
dispatch:
|
||||
CPU: replication_pad2d_backward_out_cpu
|
||||
CUDA: replication_pad2d_backward_out_cuda
|
||||
npu_dispatch:
|
||||
NPU: replication_pad2d_backward_out_npu
|
||||
|
||||
- func: replication_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: replication_pad2d_backward_cpu
|
||||
CUDA: replication_pad2d_backward_cuda
|
||||
npu_dispatch:
|
||||
NPU: replication_pad2d_backward_npu
|
||||
|
||||
- func: replication_pad3d.out(Tensor self, int[6] padding, *, Tensor(a!) out) -> Tensor(a!)
|
||||
python_module: nn
|
||||
@@ -8090,19 +8172,27 @@
|
||||
|
||||
- func: slow_conv3d.out(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias=None, int[3] stride=1, int[3] padding=0, *, Tensor(a!) out) -> Tensor(a!)
|
||||
python_module: nn
|
||||
npu_dispatch:
|
||||
NPU: slow_conv3d_out_npu
|
||||
|
||||
- func: slow_conv3d(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias=None, int[3] stride=1, int[3] padding=0) -> Tensor
|
||||
python_module: nn
|
||||
npu_dispatch:
|
||||
NPU: slow_conv3d_npu
|
||||
|
||||
- func: slow_conv3d_forward.output(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias, int[3] stride, int[3] padding, *, Tensor(a!) output, Tensor(b!) finput, Tensor(c!) fgrad_input) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: slow_conv3d_forward_out_cpu
|
||||
npu_dispatch:
|
||||
NPU: slow_conv3d_forward_out_npu
|
||||
|
||||
- func: slow_conv3d_forward(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias, int[3] stride, int[3] padding) -> (Tensor output, Tensor finput, Tensor fgrad_input)
|
||||
python_module: nn
|
||||
dispatch:
|
||||
CPU: slow_conv3d_forward_cpu
|
||||
npu_dispatch:
|
||||
NPU: slow_conv3d_forward_npu
|
||||
|
||||
- func: slow_conv3d_backward.grad_input(Tensor grad_output, Tensor self, Tensor weight, int[3] kernel_size, int[3] stride, int[3] padding, Tensor finput, Tensor fgrad_input, *, Tensor(a!)? grad_input, Tensor(b!)? grad_weight, Tensor(c!)? grad_bias) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
||||
python_module: nn
|
||||
@@ -8268,7 +8358,7 @@
|
||||
npu_dispatch_only:
|
||||
NPU: dtype_cast_npu_
|
||||
|
||||
- func: npu_roi_alignbk(Tensor self, Tensor rois, int[] xdiff_shape, int pooled_width, int pooled_height, float spatial_scale, int sample_num) -> Tensor
|
||||
- func: npu_roi_alignbk(Tensor self, Tensor rois, int[] xdiff_shape, int pooled_width, int pooled_height, float spatial_scale, int sample_num, int? roi_end_mode=None) -> Tensor
|
||||
variants: function, method
|
||||
npu_dispatch_only:
|
||||
NPU: roi_align_backward_npu
|
||||
@@ -8414,12 +8504,12 @@
|
||||
npu_dispatch_only:
|
||||
NPU: dropout_backward_npu
|
||||
|
||||
- func: npu_indexing(Tensor self, int[] begin, int[] end, int[] strides) -> Tensor
|
||||
- func: npu_indexing(Tensor self, int[] begin, int[] end, int[] strides, int begin_mask=0, int end_mask=0, int ellipsis_mask=0, int new_axis_mask=0, int shrink_axis_mask=0) -> Tensor
|
||||
variants: function, method
|
||||
npu_dispatch_only:
|
||||
NPU: indexing_npu
|
||||
|
||||
- func: npu_indexing.out(Tensor self, int[] begin, int[] end, int[] strides, *, Tensor(a!) out) -> Tensor(a!)
|
||||
- func: npu_indexing.out(Tensor self, int[] begin, int[] end, int[] strides, int begin_mask=0, int end_mask=0, int ellipsis_mask=0, int new_axis_mask=0, int shrink_axis_mask=0, *, Tensor(a!) out) -> Tensor(a!)
|
||||
npu_dispatch_only:
|
||||
NPU: indexing_out_npu
|
||||
|
||||
@@ -8548,4 +8638,12 @@
|
||||
|
||||
- func: npu_bert_apply_adam(Tensor(a!) var, Tensor(b!) m, Tensor(c!) v, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, Scalar max_grad_norm, Scalar global_grad_norm, Scalar weight_decay) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
||||
npu_dispatch_only:
|
||||
NPU: bert_apply_adam_npu
|
||||
NPU: bert_apply_adam_npu
|
||||
|
||||
- func: npu_giou(Tensor self, Tensor gtboxes, bool trans=False, bool is_cross=False, int mode=0) -> Tensor
|
||||
npu_dispatch_only:
|
||||
NPU: giou_npu
|
||||
|
||||
- func: npu_giou_backward(Tensor grad, Tensor bboxes, Tensor gtboxes, bool trans=False, bool is_cross=False, int mode=0) -> (Tensor, Tensor)
|
||||
npu_dispatch_only:
|
||||
NPU: giou_backward_npu
|
||||