Versions#
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.
!sh enable_env_in_jupyter.sh
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
print(torch.__version__)
1.11.0
import torchvision
print(torchvision.__version__)
0.12.0a0+76b4a42
import pytorch_lightning as pl
print(pl.__version__)
2.0.7
import monai
print(monai.__version__)
1.2.0
import scipy
print(scipy.__version__)
1.11.2
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
print(torch.cuda.is_available())
True
# 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
x.to(device)
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.
Start a jupyter lab session on taurus. Make sure to select at least one GPU.
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 https://gitlab.mn.tu-dresden.de/bia-pol/singularity-devbio-napari.git cd singularity-devbio-napari ./install.sh <version>
Replace
<version>
with the version you want to install. For this session,pol-course-pytorch
is the most suitable.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.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.