Installation#
Requirements#
CUDA ≥ 10.2 supported GPU.
Linux with Python ≥ 3.8
PyTorch ≥ 1.6
Install using Docker#
We provide a Dockerfile which install DIRECT with a few commands. While recommended due to the use of specific pytorch features, DIRECT should also work in a virtual environment.
Docker Installation#
Use the container#
To build the image:
cd direct/
docker build -t direct:latest -f docker/Dockerfile .
To run DIRECT using all GPUs:
docker run --gpus all -it \
--shm-size=24gb --volume=<source_to_data>:/data --volume=<source_to_results>:/output \
--name=direct direct:latest /bin/bash
Requirements#
docker ≥ 19.03
Install using conda
#
First, install conda. Here is a guide on how to install conda on Linux if you don’t already have it here. If you downloaded conda for the first time it is possible that you will need to restart your machine. Once you have conda, create a python 3.9 conda environment:
conda create -n myenv python=3.9
Then, activate the virtual environment
myenv
you created where you will install the software:conda activate myenv
If you are using GPUs, cuda is required for the project to run. To install PyTorch with cuda run:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
otherwise, install the latest PyTorch CPU version (not recommended):
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
Clone the repository using
git clone
and navigate todirect/direct/
and runpython3 setup.py install
or
python3 -m pip install -e ".[dev]"
This will install
direct
as a python module.
Using DIRECT with Bazel#
DIRECT can also be installed using bazel. If you want to use bazel, you can follow the instructions below.
Install bazelisk which is a wrapper for bazel that automatically downloads the correct version of bazel for you. You can install it using following the instructions on their GitHub page.
Once you have bazelisk installed, you can clone the repository using
git clone
and navigate todirect/
and runbazelisk build //...
This will build the DIRECT library and create a binary in the bazel-bin directory.
Make sure the tests are passing by running: .. code-block:
bazelisk test //...
To use DIRECT commands, you follow the normal run commands (e.g., training or inference ), but with including the bazelisk command. For example, to run the training command, you can use:
bazelisk run //direct:direct -- train <experiment_directory> --num-gpus <number_of_gpus> \ --cfg <path_or_url_to_yaml_file> [--training-root <training_data_root> \ --validation-root <validation_data_root>] [--other-flags]
Common Installation Issues#
If you met issues using DIRECT, please first update the repository to the latest version, and rebuild the docker. When this does not work, create a GitHub issue so we can see whether this is a bug, or an installation problem.