Install pruna
Prerequisites
pruna is officially supported on Linux. While it can be used on macOS and Windows, compatibility depends on the specific algorithms you plan to use, as some may have platform-specific dependencies. If you don’t have access to a Linux environment, you can still easily experiment with pruna using cloud platforms like Google Colab.
Conda is the recommended way create and manage your python environments.
If you don’t already have it, you can download and install Miniconda from here. When you have Conda installed, you can create a new environment as follows:
conda create -n pruna python=3.11
conda activate pruna
If you are on a CUDA-enabled machine, you will need to make sure that the CUDA runtime toolkit is installed.
You can check that nvcc --version
provides a version that matches your nvidia-smi
version. If nvcc --version
fails or there is a version mismatch, you should install the correct CUDA runtime toolkit as follows:
conda install nvidia/label/cuda-12.4.0::cuda
Installing Pruna
If all prerequisites are met, you can simply install pruna with the following commands:
pip install pruna==0.2.4
pip install pruna==0.2.4 --extra-index-url https://download.pytorch.org/whl/cpu
Additionally, there are a few algorithms that require additional dependencies.
Extra Name |
Description |
---|---|
|
StableFast compiler for diffusion models |
|
StableFast with CUDA 11 support |
|
GPTQ quantization support |
|
AWQ quantization support |
|
All optimization algorithms |
Tip
You can simply install all algorithms by using the full
extra:
pip install "pruna[full]"
You can find out if your desired algorithm requires additional dependencies by checking the Algorithms Overview page.