Use DIRECT with Google Colab

Use DIRECT with Google Colab#

  1. First mount your Google drive in Colab and create a directory named, e.g. DIRECT, and cd there:

%cd /content/drive/MyDrive/DIRECT/

This notebook can help with mounting your Google drive.

  1. Clone the repo:

!git clone https://github.com/NKI-AI/direct.git
  1. Copy paste and run the following

!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py38_4.8.2-Linux-x86_64.sh
!chmod +x mini.sh
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y jupyter
!conda install -q -y google-colab -c conda-forge
!python -m ipykernel install --name "py38" --user

The above block is needed to install python 3.8 in Colab as it runs using Python 3.7.

  1. Run the following to install the latest PyTorch version:

!pip3 uninstall torch
!pip3 uninstall torchvision
!pip3 uninstall torchaudio
!pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
  1. Navigate to the repo:

%cd direct/
  1. Install package.

!python3 setup.py install

OR

!python3 -m pip install -e ".[dev]"

7. Run experiments using the configuration files in the projects folder, or you can set up your own configuration files following our template.