NPU Compiler Installation*
1. Environment Setup*
-
Python Environment
Supports Linux with Python 2.7, Python 3.6, Python 3.7.
Note: If users need to compile and convert PyTorch models, the NPU compiler version must be at least 1.6.0b0 or above, and Python 3.7 must be used.
-
Frontend Deep Learning Framework Version Requirements
- TensorFlow 1.4 - 1.15
- PyTorch 1.10 - 1.13
2. Install the gxnpuc toolchain*
$ pip install npu_compiler
3. Update gxnpuc toolchain*
$ pip install --upgrade npu_compiler
4. Check the toolchain version*
After the installation or update is complete, you can use the following command to view the version number of the current toolchain.
$ gxnpuc --version
important
If the following error appears when running gxnpuc --version, please refer to the following two methods to solve it:
$ gxnpuc --version
bash: gxnpuc: command not found
- Method 1: Confirm whether the gxnpuc file is in ~/.local/ bin, if yes, add ~/.local/bin to PATH In the directory, add method: add the following statement in ~/.bashrc
export PATH=~/.local/bin:$PATH
- Method 2: Check the path of gxnpuc through import npu_complier:
The output is as follows:
$ python Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import npu_compiler as nc >>> help(nc)
Finally, change /home/jindg/anaconda3/lib in the log above to /home/jindg/anaconda3/bin</ font>, and then add it to PATH in ~/.bashrc.Help on package npu_compiler: name npu_compiler - #coding: utf-8 PACKAGE CONTENTS __main__ v100 (package) v150 (package) v160 (package) DATA VERSION = '1.5.6' FILE /home/jindg/anaconda3/lib/python3.6/site-packages/npu_compiler/__init__.py
Attention
If the problem still cannot be solved, please contact NationalChip engineers.