This page provides instructions to install AIMET package on Ubuntu 18.04 LTS with Nvidia GPU (see system requirements). Please follow the instructions in the order provided, unless specified otherwise.
NOTE:
- Please pre-pend the "apt-get install" and "pip3 install" commands with "sudo -H" as appropriate.
- These instructions assume that pip packages will be installed in the path: /usr/local/lib/python3.8/dist-packages. If that is not the case, please modify it accordingly.
Install the basic pre-requisite packages as follows:
apt-get update
apt-get install python3.8 python3.8-dev python3-pip
python3 -m pip install --upgrade pip
apt-get install --assume-yes wget gnupg2
NOTE: Do this section ONLY for the PyTorch or Tensorflow GPU packages.
Prepare the environment for installation of GPU packages as follows:
NOTE: Please visit this page to obtain the exact and up-to-date installation instructions for your environment.
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
apt-get update
apt-get -y install cuda
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
apt-get --assume-yes install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
apt-get update
Go to https://github.com/quic/aimet/releases and identify the release tag of the package you want to install.
Set the <variant_string>
to ONE of the following depending on your desired variant
- For the PyTorch GPU variant, use
"torch_gpu"
- For the PyTorch CPU variant, use
"torch_cpu"
- For the TensorFlow GPU variant, use
"tf_gpu"
- For the TensorFlow CPU variant, use
"tf_cpu"
export AIMET_VARIANT=<variant_string>
Replace <release_tag>
in the steps below with the appropriate tag:
export release_tag=<release_tag>
Set the package download URL as follows:
export download_url="https://github.com/quic/aimet/releases/download/${release_tag}"
Set the common suffix for the package files as follows:
NOTE: Set wheel_file_suffix to
cp38-cp38-linux_x86_64.whl
ORcp36-cp36m-linux_x86_64
ORcp37-cp37m-linux_x86_64
ORpy3-none-any
as appropriate depending on the actual wheel filename(s) on the releases page.
export wheel_file_suffix="cp38-cp38-linux_x86_64.whl"
Install the AIMET packages in the order specified below:
NOTE: Python dependencies will automatically get installed.
python3 -m pip install ${download_url}/AimetCommon-${AIMET_VARIANT}_${release_tag}-${wheel_file_suffix}
# Install ONE of the following depending on the variant
python3 -m pip install ${download_url}/AimetTorch-${AIMET_VARIANT}_${release_tag}-${wheel_file_suffix} -f https://download.pytorch.org/whl/torch_stable.html
# OR
python3 -m pip install ${download_url}/AimetTensorflow-${AIMET_VARIANT}_${release_tag}-${wheel_file_suffix}
python3 -m pip install ${download_url}/Aimet-${AIMET_VARIANT}_${release_tag}-${wheel_file_suffix}
Install the common debian packages as follows:
cat /usr/local/lib/python3.8/dist-packages/aimet_common/bin/reqs_deb_common.txt | xargs apt-get --assume-yes install
NOTE: Do this section ONLY for the TensorFlow GPU package.
Install the tensorflow GPU debian packages as follows:
cat /usr/local/lib/python3.8/dist-packages/aimet_tensorflow/bin/reqs_deb_tf_gpu.txt | xargs apt-get --assume-yes install
NOTE: Do this section ONLY for the PyTorch GPU package.
Install the torch GPU debian packages as follows:
cat /usr/local/lib/python3.8/dist-packages/aimet_torch/bin/reqs_deb_torch_gpu.txt | xargs apt-get --assume-yes install
Optional: Replace the Pillow package with Pillow-SIMD as follows:
python3 -m pip uninstall -y pillow
python3 -m pip install --no-cache-dir Pillow-SIMD==7.0.0.post3
Perform the following post-installation steps:
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
NOTE: Do the following step ONLY for the PyTorch or Tensorflow GPU packages.
# If you installed the CUDA 11.x drivers
ln -s /usr/local/cuda-11.0 /usr/local/cuda
# OR if you installed the CUDA 10.x drivers
ln -s /usr/local/cuda-10.0 /usr/local/cuda
Set the common environment variables as follows:
source /usr/local/lib/python3.8/dist-packages/aimet_common/bin/envsetup.sh
Add the AIMET package location to the environment path as follows:
export LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/aimet_common:$LD_LIBRARY_PATH