Qarnot Technical Team
Engineers
HPC platform
Launch compute tasks in a few lines of code or a few clicks on Tasq, our HPC platform.

JupyterLab on Qarnot Cloud - documentation

December 3, 2021 - HPC discovery, Documentation, Machine Learning / AI

Introduction

JupyterLab is a web-based interactive development environment for Jupyter notebooks, code, and data. It is flexible: configure and arrange the user interface to support a wide range of workflows in data science, scientific computing, and machine learning.

This a step-by-step guide on how to launch a JupyterLab instance on Qarnot with minimal code, connect to it  and run an example of facial classification.

Version

Release yearVersion
20213.1.12

If you are interested in another version, please send us an email at qlab@qarnot.com.

Prerequisites

Before starting a calculation with the Python SDK, a few steps are required:

  • Retrieve the authentication token (here)
  • Install Qarnot’s Python SDK (here)

Note: in addition to the Python SDK, Qarnot provides C# and Node.js SDKs and a Command Line.

Test Case

The use case showcased in this tutorial consists of uploading a Jupyter notebook on Qarnot and working on it in a JupyterLab session through a SSH connection. It is also possible to create a new notebook directly through the JupyterLab interface on Qarnot and work on it that way.

This test case consists of running a notebook to perform a simple facial recognition task. Provided images of a number of people, we want to train Machine Learning algorithms to classify these pictures.

The notebook contains code to reproduce the official Scikit-learn face recognition example. We will be using Support Vector Machines (SVMs), a supervised classification and regression model, combined with eigenfaces, a lower dimensionality representation of a human face generated using Principal Component Analysis (PCA).

Before moving forward, make sure to download the notebook you will need for this tutorial from here.
 

Launching the test case

Once you have downloaded the notebook, all you have to do is click on the following link to get access to the Jupyter notebook hosted on Binder. This notebook will play the role of a graphical interface for the user to provide the necessary inputs to launch the task without any coding.

  • Note that this could take a few minutes depending on if the notebook was recently launched or if there is a queue for launching Binder.
  • The page can occasionally not load properly (especially if it was not used for a certain amount of time). If that happens to you, you can just refresh the page or relaunch it a second time which should only take a few seconds.

Once the notebook is running, you should have this page loaded in your browser.

 

 

Setting form parameters

You can see there are a number of fields in the page, here is an overview of what they do:

  • Your secret Qarnot token
  • Your public SSH key
    • By default, your public SSH key can be found in ~/.ssh/<ssh_key>.pub.
  • Optional task and bucket names
  • Select which software package you want to use : corresponds to a docker image containing different pre-installed Machine Learning & Deep Learning libraries.
    • Make sure to choose the Scikit-learn image
  • Upload your input files: can be data files, text files, any type of file you want to use with your JupyterLab instance.
    • For this example, make sure to upload the provided face-reco.ipynb notebook.
  • Choose whether you want to use your previous output bucket as an input bucket. This is mainly useful if you want to continue working on your previous notebook with any python packages you may have installed previously. Leave it unchecked for this tutorial.

Launching JupyterLab

  • Once all parameters have been set, all you have to do is click on the Start JupyterLab on Qarnot button.
  • You can monitor your task's progress through live logs
  • A few moments later, once everything is ready, you will have the following outputs in your Binder notebook

  • Copy and paste the SSH command in your local terminal to establish the SSH tunneling with Qarnot.
  • Then click on the link to be redirected to your JupyterLab instance running on Qarnot.

Note that once the task is in FullyExecuting state, you are consuming credits whether you connect to the JupyterLab instance or not. So make sure to connect to it and abort the task once your are done.

Running the notebook

  • Once everything is ready, you should have access to your Jupyter Lab instance where you can open the notebook you just uploaded. It should look something like the following

 

  • All you have left to do is run the cells in the notebook and follow along until the end.

Results

You can view the results from JupyterLab or from the bucket explorer. For example, below are the confusion matrix and images of some of the predicted faces.

Confusion matrix

 

Predicted faces

 

Once you are done with the task, just click on the Abort Task button in the Binder notebook. If you do not abort the task manually, it will continue running and use your credits.

Then you can click on the Download Outputs to download, on your local machine, a zip file containing all the outputs from your task.

After having aborted the task and downloaded your files, your binder interface should look like this

 

Wrapping up

That’s it! If you have any questions please contact qlab@qarnot.com and we will help you with pleasure!

 

 

Share on networks