As for every machine learning project, managing software and sofware dependencies is key. We have tried to make this process as easy as possible. Execute the cell below and you should be fine.


After you have launched the above cell and you do not get an error, you need to close the current notebook and reopen it. Then you should see the kernel torch_intro_env be available in the top right menue.

The cells below are meant as a cross check to see if everything works as expected.

import torch
import torchvision
import pytorch_lightning as pl
import monai
import scipy

After we made sure, that all software is available at the versions we intended, let’s look around the available hardware a bit.

print("cuda devices available:", torch.cuda.device_count())
cuda devices available: 1
# let's create a regular n-dimensional object, in torch this is called a Tensor
x = torch.ones(10, 2, 32, 42)
device = torch.device("cuda")
# moving a tensor onto an accelerator is as easy as the following line

Fallback Environment#

Should there be any trouble with running the first cell in this notebook, there is another way to set up the kernel that will work with all or most of the notebooks.

  1. Start a jupyter lab session on taurus. Make sure to select at least one GPU.

  2. In Jupyter lab, open a terminal and type the following commands. IMPORTANT: make sure to wait until the script reports that it is done. otherwise you may end up with a broken partial singularity image in your ~/.singularity/cache directory.

    git clone
    cd singularity-devbio-napari
    ./ <version>

    Replace <version> with the version you want to install. For this session, pol-course-pytorch is the most suitable.

  3. You should now see an additional button named devbio napari on the jupyter lab home screen. Note: you may need to reload the page first.

  4. Klick on that button to start a jupyter notebook inside the singularity container. Note that the first command execution will take a while because of the additional time it takes to start the singularity container.