Installing Pruna with Pip and Conda

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

or

conda install nvidia/label/cuda-11.8.0::cuda

Installing Pruna

If all prerequisites are met, you can simply install pruna with the following commands:

pip install pruna==0.2.0

Additionally, there are a few algorithms that require additional dependencies. You can find out if your desired algorithm requires additional dependencies by checking the Algorithms Overview page. For example, if you want to install stable_fast you need to execute the following command:

pip install pruna[stable-fast]==0.2.0

Finally, if you want to install all of the dependencies for all of the algorithms, you can install the full version of pruna with the following command:

pip install pruna[full]==0.2.0

Installing Pruna Pro

If you want to install the Pro version of pruna, you can do so with the following command:

pip install pruna_pro==0.2.0

Similarly to pruna, you can install specific algorithm dependencies or the full version of pruna_pro.

To use pruna_pro, you will additionally need a pruna token. We will release an automatic payment system in the coming release, for now, here’s how to get your token:

  1. Join our Discord server

  2. Go to the #pruna-pro channel

  3. Request a token in the channel by sending a quick message

You should then pass your pruna token directly in your smash function call:

from pruna_pro import smash

smash(model, smash_config, token='<your_pruna_token>') # add your token here