CLI - Launch an AI notebook

Learn how to run an AI Notebook using the CLI

Last updated 1st September, 2022.


This guide covers the submission of notebooks through the ovhai CLI.



Run a new notebook

First, you need to select one of the machine learning frameworks and an editor among those available. You can get a list of them using the ovhai capabilities framework list and ovhai capabilities editor list commands:

$ ovhai capabilities framework list
ID                       NAME                       DOC_URL                                         VERSIONS
fastai                   fastai Course                               2021-08-04-ovh.beta.1
pytorch                  PyTorch                pytorch1.10.1-py39-cuda10.2-v22-4,pytorch1.9.0-py39-cuda10.2-v22-4,1.8.1-ovh.beta.1
mxnet                    MXNet                    1.5.0-ovh.beta.1
conda                    Miniconda          conda-py39-cuda11.2-v22-4,conda-py39-cpu-v22-4,conda-py39-cuda11.3-v22-4,conda-py39-cuda11.0-v22-4,conda-py39-cuda10.2-v22-4,conda-py39-cuda10.1-v22-4,conda-py39-cuda10.0-v22-4,conda-py38-cuda11.3-v22-4,conda-py38-cuda11.2-v22-4,conda-py38-cuda11.0-v22-4,conda-py38-cuda10.2-v22-4,conda-py38-cuda10.1-v22-4,conda-py38-cuda10.0-v22-4,conda-py38-cpu-v22-4,conda-py39-cudaDevel11.3-v22-4,conda-py39-cudaDevel11.2-v22-4,conda-py39-cudaDevel11.0-v22-4,conda-py39-cudaDevel10.2-v22-4,conda-py39-cudaDevel10.1-v22-4,conda-py39-cudaDevel10.0-v22-4,conda-py38-cudaDevel11.3-v22-4,conda-py38-cudaDevel11.2-v22-4,conda-py38-cudaDevel11.0-v22-4,conda-py38-cudaDevel10.2-v22-4,conda-py38-cudaDevel10.1-v22-4,conda-py38-cudaDevel10.0-v22-4,conda-py39-cuda11.2-v0.5-beta,conda-py39-cuda11.0-v0.5-beta,conda-py39-cuda10.2-v0.5-beta,conda-py39-cuda10.1-v0.5-beta,conda-py39-cuda10.0-v0.5-beta,conda-py38-cuda11.2-v0.5-beta,conda-py38-cuda11.0-v0.5-beta,conda-py38-cuda10.2-v0.5-beta,conda-py38-cuda10.1-v0.5-beta,conda-py38-cuda10.0-v0.5-beta,conda-py37-cuda11.2-v0.5-beta,conda-py37-cuda11.0-v0.5-beta,conda-py37-cuda10.2-v0.5-beta,conda-py37-cuda10.1-v0.5-beta,conda-py37-cuda10.0-v0.5-beta
sklearn                  Scikit Learn      sklearn1.0.2-py39-cpu-v22-4
perceval                 Quandela Perceval   perceval0.6.1-py39-cpu-v22-4,perceval0.5.2-py39-cpu-v22-4
tensorflow               Tensorflow                    tf2.8-py39-cuda11.2-v22-4,tf2.7-py39-cuda11.2-v22-4,tf2.6-py39-cuda11.2-v22-4,tf2.5-py39-cuda11.2-v22-4,tf2.4-py38-cuda11.0-v22-4,tf2.3-py38-cuda10.1-v22-4,tf2.2-py38-cuda10.1-v22-4,tf2.6-py39-cuda11.2-v0.5-beta,tf2.6-py38-cuda11.2-v0.5-beta,tf2.6-py37-cuda11.2-v0.5-beta,tf2.5-py39-cuda11.2-v0.5-beta,tf2.5-py38-cuda11.2-v0.5-beta,tf2.5-py37-cuda11.2-v0.5-beta,tf2.4-py38-cuda11.0-v0.5-beta,tf2.4-py37-cuda11.0-v0.5-beta,tf2.3-py38-cuda10.1-v0.5-beta,tf2.3-py37-cuda10.1-v0.5-beta,tf2.2-py38-cuda10.1-v0.5-beta,tf2.2-py37-cuda10.1-v0.5-beta,2.4.1-ovh.beta.1
huggingface-transformers Hugging Face Transformers            4.5.0-ovh.beta.1
one-for-all              One image to rule them all                                                 v98-ovh.beta.1
autogluon-mxnet          AutoGluon + MXNet                                                          0.1.0-ovh.beta.1

$ ovhai capabilities editor list
ID         NAME       DOC_URL
jupyterlab JupyterLab
vscode     VSCode

In our example, we will create a new notebook using PyTorch and JupyterLab, with 1 GPU:

$ ovhai notebook run --gpu 1 pytorch jupyterlab

id: fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e
createdAt: "2021-05-27T12:37:14.752980089Z"
updatedAt: "2021-05-27T12:37:14.752980089Z"
user: user-6quQBpkve6AT
  name: ""
  labels: {}
    gpu: 1
    gpuModel: Tesla-V100S
    cpu: 13
  volumes: []
  unsecureHttp: false
    frameworkId: pytorch
    frameworkVersion: 1.8.1
    editorId: jupyterlab
  lastTransitionDate: ~
  infos: ~
  state: STARTING
  duration: 0
  url: ~
  monitoringUrl: ~
  lastStartedAt: ~
  lastStoppedAt: ~
  dataSync: []

The first line in the output shows the ID of the notebook: fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e.

The "Url" corresponds to your JupyterLab server. Pasting this URL in your browser displays the following screen:


If you don't have the ID of the notebook you want to access, you can list all your notebooks using:

$ ovhai notebook ls

We need to wait a few seconds for the notebook to start. You can get the notebook information again using its ID:

$ ovhai notebook get fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e

ID:         fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e
Created At: 27-05-21 12:37
Updated At: 27-05-21 12:37
User:       user-6quQBpkve6AT
    GPU:       1
    GPU Model: Tesla-V100S
    CPU:       13
  Unsecure: false
    Framework ID:    pytorch
    Framework Version: 1.8.1
    Editor ID:       jupyterlab
  State:           RUNNING
  Transitioned At:
  Duration:        67s
  Monitoring Url:
  Transitioned At: 27-05-21 12:37

Now that the notebook is in the RUNNING state, a https address is defined in the "Url" field. This URL corresponds to your JupyterLab server. Pasting this URL in your browser displays the following screen:


You can now start writing code in your notebook. Since we used the PyTorch framework in our example, we will be able to use it without having to install anything ourselves.

Once you are done with your notebook, you can stop it with the command below:

$ ovhai notebook stop fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e

Stopping a notebook will make it unavailable from your browser, and start synchronising volumes mounted with RW permissions to your object storage.

Once the synchronisation is finished, and the notebook state is STOPPED, you can either start it again or delete it.

Being able to restart a notebook is one of the main differences compared to using jobs. Restarting a notebook will restore your notebook code as it was when you stopped it. However, you will need to re-run your code to reload your variables because the program state is not saved. To restart a notebook, run this command:

$ ovhai notebook start fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e

You are billed for RUNNING notebooks but not for STARTING, STOPPING and STOPPED notebooks. However, to restore your code when you restart a STOPPED notebook, it needs to be stored in your object storage, which you are billed for.

This is useful when you work on a notebook for some time. If you know you will not use a notebook anymore, you can delete it:

$ ovhai notebook delete fa43cdad-97cc-46e7-ac3b-31dd1d7d5a1e

Note that a notebook can be deleted even if it is not stopped, and that deleted notebook cannot be restarted.

The notebook state stored in the Object Storage (including your notebook files) is not cleaned up automatically after notebook deletion. You can find it and delete it in the notebooks_workspace container of your Object Storage, under the notebook ID directory.

Going further

Learn how to access your object storage data from your notebooks here.

Learn how to share your notebooks with other people here.


Please send us your questions, feedback and suggestions to improve the service:

Questa documentazione ti è stata utile?

Prima di inviare la valutazione, proponici dei suggerimenti per migliorare la documentazione.

Immagini, contenuti, struttura... Spiegaci perché, così possiamo migliorarla insieme!

Le richieste di assistenza non sono gestite con questo form. Se ti serve supporto, utilizza il form "Crea un ticket" .

Grazie per averci inviato il tuo feedback.

Potrebbero interessarti anche...

OVHcloud Community

Accedi al tuo spazio nella Community Fai domande, cerca informazioni, pubblica contenuti e interagisci con gli altri membri della Community OVHcloud

Discuss with the OVHcloud community

Conformemente alla Direttiva 2006/112/CE e successive modifiche, a partire dal 01/01/2015 i prezzi IVA inclusa possono variare in base al Paese di residenza del cliente
(i prezzi IVA inclusa pubblicati includono di default l'aliquota IVA attualmente in vigore in Italia).