Installation#

Requirements: Python 3.8+.

First, clone the repositories:

git clone "https://github.com/InterDigitalInc/CompressAI.git" compressai
git clone "https://github.com/InterDigitalInc/CompressAI-Trainer.git" compressai-trainer

Virtual environment#

Using venv#

Create a virtual environment and install as editable:

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install --editable ./compressai-trainer
pip install --editable ./compressai

Using poetry#

Poetry helps manage version-pinned virtual environments. First, install Poetry:

curl -sSL https://install.python-poetry.org | python3 -

Then, create the virtual environment and install the required Python packages:

cd compressai-trainer

# Install Python packages to new virtual environment.
poetry install
echo "Virtual environment created in $(poetry env list --full-path)"

# Link to local CompressAI source code.
poetry run pip install --editable ../compressai

To activate the virtual environment, run:

poetry shell