
Hands-on: PyTorch notebooks with JupyterLab¶
In this part, you will get familiar with running Jupyter notebooks on the MeluXina HPC system. We will guide you through setting up the environment, i.e., running your JupyterLab instance on a compute node and executing the code from within the browser. The examples below focus specifically on PyTorch notebooks, which have been taken directly from the official PyTorch tutorials to get started with practical deep learning workflows. It aims to be concrete examples of how to run standard out-of-box Jupyter notebooks on the MeluXina supercomputer with minimal adaptation.
▶️ Running JupyterLab¶
Similar to ParaView, JupyterLab is started from the MeluXina web-portal, allowing you to use the Jupyter interface from your local browser.
👉 Start the MeluXina web-portal: https://portal.lxp.lu/.
👉 Open the Jupyter Notebook application.
- Click on the Jupyter Notebook application on the web-portal.
-
Use the settings defined below and click the Launch button.
Your Python Virtual Environment Path
The setting "Your Python Virtual Environment Path" defines a path to your own Python virtual environment (
venv), new or existing. You should set it to a path where you have write permission.You can use the value
/project/home/p201259/workspaces/u10XXXX/venv-sc26-pytorch/making sure to replaceu10XXXXby your own username. -
Wait for job to run and then click the Launch Jupyter Notebook button as shown below.

You now have JupyterLab software running on a MeluXina compute node. You can use it to import and execute Jupyter Notebook (in Python, R, Julia, etc.) or develop your own.
Before opening any notebook, let's set the working directory. To avoid any conflicts with other users of the same project, create a working directory in /project/home/p201259/workspaces/u10XXXX/pytorch_notebooks/ (replace u10XXXX with your own username).
👉 Set your working directory in JupyterLab
-
In the JupyterLab file browser at the top left, navigate to
/p201259/workspaces/u10XXXX. -
Create a new directory named
pytorch_notebooksand navigate into it.
You're now ready to work on the next steps.
▶️ Training a Classifier Tutorial¶
In this section, you will execute the PyTorch tutorial Training a Classifier. It is one of the official PyTorch tutorials that you can find here:
https://docs.pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html.
This notebook uses the CIFAR10 dataset and trains a model to recognize objects classes: ‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’. For more details, you can refer to the content of the tutorial itself.
The notebook can be downloaded from the page of the tutorial by clicking on the top button Download Notebook.
👉 Open the "Training a Classifier" notebook in JupyterLab
-
In JupyterLab, go to the menu File and click Open from URL....
-
Paste the URL of the PyTorch notebook:
-
In the top menu Kernel, click on Change Kernel.... Then select the pre-configured PyTorch kernel Python (venv-sc26-pytorch).
Name of the pre-configured kernel
The name of the pre-configured PyTorch kernel, i.e., Python (venv-sc26-pytorch) is actually the last component of the path set in the "Your Python Virtual Environment Path" in the JupyterLab settings defined earlier.
👉 Now, you can execute the notebook and follow the PyTorch tutorial "Training a Classifier" on your own.
▶️ TorchVision Object Detection Finetuning Tutorial¶
In this section, you will execute the PyTorch tutorial TorchVision Object Detection Finetuning. It is one of the official PyTorch tutorials that you can find here:
https://docs.pytorch.org/tutorials/intermediate/torchvision_tutorial.html.
For this tutorial, we will be finetuning a pre-trained Mask R-CNN model on the Penn-Fudan Database for Pedestrian Detection and Segmentation. It contains 170 images with 345 instances of pedestrians, and we will use it to illustrate how to use the new features in torchvision in order to train an object detection and instance segmentation model on a custom dataset.
The notebook can be downloaded on the page of the tutorial by clicking on the top button Download Notebook
We will follow an approach similar to the previous one.
👉 Open the "TorchVision Object Detection Finetuning" notebook in JupyterLab
-
In JupyterLab, go to the menu File and click Open from URL....
-
Paste the URL of the PyTorch notebook:
-
In the top menu Kernel, click on Change Kernel.... Then select the pre-configured PyTorch kernel Python (venv-sc26-pytorch).
👉 Now, you can execute the notebook and follow the PyTorch tutorial "TorchVision Object Detection Finetuning" on your own.
Additional Python modules
This second notebook requires the installation of an additional Python module to run successfully. To do that, you can create a new cell at the top of the notebook with the following content:










