Tool Installation

This section describes the commands for installing AMCT.

AMCT (PyTorch)

  1. In the directory where the AMCT package is located, run the following command to install from the source code (if installing as root, delete --user from the installation command):
    pip3 install amct_pytorch-{version}-py3-none-linux_{arch}.tar.gz --user

    Replace {version} with the actual AMCT version number, and {arch} with the actual architecture of the installation server. If AMCT installation is performed by the root user and the --target option is included, ensure that the path specified by --target is the path of the current user.

    • When installing AMCT (PyTorch), ensure that the pip version is 25.2 or earlier. Otherwise, the error message ModuleNotFoundError:No module named 'torch' may be displayed. If your pip version is later than 25.2 and you do not want to downgrade the version, modify the preceding installation command as follows:

      pip3 install amct_pytorch-{version}-py3-none-linux_{arch}.tar.gz --user --no-build-isolation

    • amct_pytorch and amct_tensorflow cannot be imported in the same Python process. The two packages share the same basic_info.proto file. If they are imported at the same time, the .proto file is repeatedly defined.

      amct_tensorflow is the installation directory of AMCT under the TensorFlow framework. The basic_info.proto file is stored in /proto under the AMCT installation directory.

  2. If the following message is displayed, the installation is successful:
    1
    2
    3
    Successfully build amct-pytorch
    ...
    Successfully installed amct-pytorch-{version}
    

    Find the installed AMCT in the path where the Python package is located (for example, $HOME/.local/lib/python3.9/site-packages).

    1
    2
    drwxr-xr-x  5 amct amct   4096 Mar 17 11:50 amct_pytorch/
    drwxr-xr-x  2 amct amct   4096 Mar 17 11:50 amct_pytorch-{version}.dist-info/
    

    amct_pytorch indicates the AMCT installation directory.

AMCT (ONNX)

  1. Install AMCT.
    In the directory where the AMCT package is located, run the following command (if installing as root, delete --user from the installation command):
    pip3 install amct_onnx-{version}-py3-none-linux_{arch}.whl --user

    Replace {version} with the actual AMCT version number, and {arch} with the actual architecture of the installation server. If AMCT installation is performed by the root user and the --target option is included, ensure that the path specified by --target is the path of the current user.

  2. If the following message is displayed, the installation is successful:
    1
    Successfully installed amct-onnx-{version}
    

    Find the installed AMCT in the path where the Python package is located (for example, $HOME/.local/lib/python3.9/site-packages).

    1
    2
    drwxr-xr-x  5 amct amct   4096 Mar 17 11:50 amct_onnx/
    drwxr-xr-x  2 amct amct   4096 Mar 17 11:50 amct_onnx-{version}.dist-info/
    

    amct_onnx indicates the AMCT installation directory.

AMCT (TensorFlow)

  1. In the directory where the AMCT package is located, run the following command (if installing as root, delete --user from the installation command):

    The package in this format is installed using the source code. During the installation, the build and installation operations are performed.

    pip3 install amct_tensorflow-{version}-py3-none-linux_{arch}.tar.gz --user

    Replace {version} with the actual AMCT version number, and {arch} with the actual architecture of the installation server. If AMCT installation is performed by the root user and the --target option is included, ensure that the path specified by --target is the path of the current user.

    If you fail to install AMCT using the source package due to lack of certain build dependencies on the installation server, build the source package into a .whl package for installation by referring to AMCT Installation with .whl Package Built from Source Package.

  2. If the following message is displayed, the installation is successful:
    1
    Successfully installed amct-tensorflow-{version}
    

    Find the installed AMCT in the path where the Python package is located (for example, $HOME/.local/lib/python3.9/site-packages).

    1
    2
    drwxr-xr-x  5 amct amct   4096 Mar 17 11:50 amct_tensorflow/
    drwxr-xr-x  2 amct amct   4096 Mar 17 11:50 amct_tensorflow-{version}.dist-info/
    

    amct_tensorflow indicates the AMCT installation directory.

    amct_tensorflow and amct_pytorch cannot be imported in the same Python process. The two packages share the same basic_info.proto file. If they are imported at the same time, the .proto file is repeatedly defined.

    amct_pytorch is the installation directory of AMCT under the PyTorch framework. The basic_info.proto file is stored in /proto under the AMCT installation directory.

AMCT (Caffe)

  1. In the directory where the AMCT package is located, run the following command (if installing as root, delete --user from the installation command):
    pip3 install amct_caffe-{version}-py3-none-linux_{arch}.whl --user

    Replace {version} with the actual AMCT version number, and {arch} with the actual architecture of the installation server. If AMCT installation is performed by the root user and the --target option is included, ensure that the path specified by --target is the path of the current user.

  2. If the following message is displayed, the installation is successful:
    1
    Successfully installed amct-caffe-{version}
    

    Find the installed AMCT in the path where the Python 3.9.2 package is located (for example, $HOME/.local/lib/python3.9/site-packages).

    1
    2
    drwxr-xr-x  5 amct amct   4096 Mar 17 11:50 amct_caffe/
    drwxr-xr-x  2 amct amct   4096 Mar 17 11:50 amct_caffe-{version}.dist-info/
    

    amct_caffe indicates the AMCT installation directory.

AMCT (TensorFlow, Ascend)

  1. In the directory where the AMCT package is located, run the following command (if installing as root, delete --user from the installation command):

    The package in this format is installed using the source code. During the installation, the build and installation operations are performed.

    pip3 install amct_tensorflow_ascend-{version}-py3-none-linux_{arch}.tar.gz --user

    Replace {version} with the actual AMCT version number, and {arch} with the actual architecture of the installation server. If AMCT installation is performed by the root user and the --target option is included, ensure that the path specified by --target is the path of the current user.

    If you fail to install AMCT using the source package due to lack of certain build dependencies on the installation server, build the source package into a .whl package for installation by referring to AMCT Installation with .whl Package Built from Source Package.

  2. If the following message is displayed, the installation is successful:
    1
    Successfully installed amct-tensorflow-ascend-{version}
    

    Find the installed AMCT in the path where the Python package is located (for example, $HOME/.local/lib/python3.9/site-packages).

    1
    2
    drwxr-xr-x  5 amct amct   4096 Mar 17 11:50 amct_tensorflow/
    drwxr-xr-x  2 amct amct   4096 Mar 17 11:50 amct_tensorflow_ascend-{version}.dist-info/
    

    amct_tensorflow indicates the AMCT installation directory.

AMCT (ACL)

This software package is required only in the following scenarios, and must be installed alongside the same version of Toolkit in the same path. For Toolkit installation, see CANN Software Installation.

  • Using the --compression_optimize_conf compression parameter in ATC
  • Using the --compression_optimize_conf compression parameter in AOE Tuning Tool
  • Using the compression feature in "Programming Guide" > "More Features" > "Quantization" in Graph Development

To install AMCT (ACL), perform the following steps:

1
2
3
4
# Ensure that the installation package is executable.
chmod +x cann-amct_acl_${cann_version}_linux-${arch}.run
# Run the installation command.
./cann-amct_acl_${cann_version}_linux-${arch}.run --run --install-path=${install_path}

After the installation is complete, configure the environment variables.

1
2
3
4
# Default path installation (using the root user as an example; for a non-root user, replace /usr/local with ${HOME})
source /usr/local/Ascend/cann/set_env.sh
# Custom path installation
source ${install_path}/cann/set_env.sh