Installing the Framework Plugin Package
Ascend provides the adaptation plugin TF Adapter for interconnecting with the deep learning framework TensorFlow. If you need to perform training or online inference of the TensorFlow network on NPUs, you need to install the TF Adapter package.
- If you install the package for the first time, see Installing the Plugin Package.
- If you have installed the package, upgrade it to the latest version. For details, see Upgrading the Plugin Package.
Installing the Plugin Package
- Download the TF Adapter installation package.
- Access the TF Adapter Gitee repository where provides various TF Adapter package version tags.
- Select a matched CANN version and click View Release to go to the Releases page.
TF Adapter repository tags follow the naming convention: tfa_${Tag version}_${TF Adapter version}. ${TF Adapter version} is the same as the matched CANN version.
- Obtain the .whl installation package of TF Adapter on the Releases page.
For TensorFlow 1.15, download npu_bridge-1.15.0-py3-none-manylinux2014_<arch>.whl.
<arch> indicates the OS architecture, which can be x86_64 or aarch64.
- Install the TF Adapter package.
- Log in to the installation environment as the installation user and upload the obtained package to any path (for example, /home/package) in the installation environment.
- Install TF Adapter.
1pip3 install "npu_bridge-1.15.0-py3-none-manylinux2014_<arch>.whl" -t "${TFPLUGIN_INSTALL_PATH}"
- Replace npu_bridge-1.15.0-py3-none-manylinux2014_<arch>.whl with the actual package name.
- ${TFPLUGIN_INSTALL_PATH} specified by -t is the installation path of the TF Adapter package, for example, /home/HwHiAiUser/Ascend/tfplugin.
To see more pip command parameters, run the pip3 --help command.
- Set the TF Adapter environment variables so that you can directly use the Python library of TF Adapter.
1export PYTHONPATH=${TFPLUGIN_INSTALL_PATH}:$PYTHONPATH
${TFPLUGIN_INSTALL_PATH} is the installation path of the TF Adapter package.
Upgrading the Plugin Package
To upgrade the TF Adapter package, you need to uninstall it and then install it.
- Uninstall the TF Adapter package.
- Scenario 1: TF Adapter 8.0.0 is packaged in .whl format for the first time. If a version earlier than TF Adapter 8.0.0 is installed in your environment, perform the following steps to uninstall it.
- Access the directory where the script is stored.
1cd /home/HwHiAiUser/Ascend/tfplugin/latest/script
/home/HwHiAiUser indicates the installation path of the TF Adapter package of a version earlier than 8.0.0. Replace it with the actual path.
- Run the uninstall.sh script to uninstall the TF Adapter package of an earlier version.
1./uninstall.sh
- Access the directory where the script is stored.
- Scenario 2: If the .whl package of TF Adapter 8.0.0 or later is installed, uninstall it by referring to Uninstalling the Plugin Package.
- Scenario 1: TF Adapter 8.0.0 is packaged in .whl format for the first time. If a version earlier than TF Adapter 8.0.0 is installed in your environment, perform the following steps to uninstall it.
- After the uninstallation is successful, install the TF Adapter .whl package of the new version by referring to Installing the Plugin Package.
Uninstalling the Plugin Package
To uninstall the TF Adapter package, run the following commands:
1 2 3 4 5 | ## Set environment variable to specify the path of the Python library of TF Adapter. export PYTHONPATH=${TFPLUGIN_INSTALL_PATH}:$PYTHONPATH # Uninstall the adaptation plugin package of TensorFlow 1.15. pip3 uninstall -y npu_bridge |