Installation

Similar to recent versions of torchvision, you should be using Python 3.8 or newer.

Pip

If you wish to use a specific version of PyTorch for compatibility with certain devices or CUDA versions, we advise on installing the corresponding versions of pytorch and torchvision first, please consult pytorch’s getting started guide. A good solution to use CUDA 11.x is to install the packages torch==1.9.0+cu111 and torchvision==0.10.0+cu111 first.

Install the package with pip (the --find-links option can be removed if torch and torchvision have already been installed):

pip install bitorch --find-links https://download.pytorch.org/whl/torch_stable.html

To use advanced logging capabilities with tensorboardX, install the optional dependencies as well:

pip install "bitorch[opt]" --find-links https://download.pytorch.org/whl/torch_stable.html

Local and Development Install Options

The package can also be installed locally for editing and development. First, clone the repository, then run:

pip install -e . --find-links https://download.pytorch.org/whl/torch_stable.html

To activate advanced logging with Tensorboard and model summary, install the optional dependencies as well:

pip install -e ".[opt]" --find-links https://download.pytorch.org/whl/torch_stable.html

Make sure the dev option is used for (local) development:

pip install -e ".[dev]" --find-links https://download.pytorch.org/whl/torch_stable.html

Dali Preprocessing

If you want to use the Nvidia dali preprocessing library (currently only supported for imagenet) you need to install the nvidia-dali-cuda110 package by running the following command:

pip install --extra-index-url https://developer.download.nvidia.com/compute/redist --upgrade nvidia-dali-cuda110

Code formatting and typing

New code should be compatible with Python 3.X versions and be compliant with PEP8. To check the codebase, please run

flake8 --config=setup.cfg .

The codebase has type annotations, please make sure to add type hints if required. We use mypy for type checking:

mypy --config-file mypy.ini

Finally, the tests can be run with:

pytest