Quick Start - Hosted Jupyter Notebooks (MNIST)

In this tutorial, we will use the Valohai Hosted Notebooks to build a machine learning model using the MNIST dataset.

Create a new Notebook instance

  • Navigate to the Notebooks tab of your project and click on Create notebook to create a new instance.

  • Give the instance a title and choose your commit version. Currently all Valohai Hosted Notebooks are created in Microsoft Azure in West Europe.

  • Once the instance is up and running you’ll be able to connect to it directly from the browser.

Notebook instances are not permanent

Keep in mind that Valohai Hosted Notebooks current shut down after 12 hours of being idle. The changes you’ve made in your Hosted Notebook instance will not be saved and won’t be accessible after the instance has shut down.

However, Valohai allows you to open a Notebook from a previous execution. On the Details-tab of an execution you can click on the Notebook-button to start a new Notebook instance with the version that was used to run the selected execution.

If this doesn’t meet your needs, consider using the Jupyhai extension.

Open a notebook

Creating new notebook

Create new notebook in the folder or choose tf-mnist-valohai.ipynb.

Configure settings

Valohai execution settings

Press the Valohai button in the toolbar and go to settings window.

Select the following:

  • Project: Valohai project where the executions will be version controlled

  • Environment: Environment type for the cloud executions (E.g. AWS p2.xlarge)

  • Docker Image: Docker image that provides the required libraries (E.g. TensorFlow)
    • Use valohai/pypermill as the base when building your custom Docker image to be used as a part of Valohai Notebook executions.

These are the same settings you would choose when using Valohai website, CLI or valohai.yaml.

Once you are happy with your selections. Press save.

Create an execution & watch the results

Running Valohai execution

Press the Valohai button in the toolbar and select Create execution.

The gizmo for the new execution will appear to the right.

You can click the #1 > Notebook button to download the finished notebook back to your local machine.

Open a Notebook from a previous execution

Each of the colored gizmos on the right side of the page signify a single Valohai execution. You can click on any of the completed executions and select Notebook to launch the Notebook version that was used to run the execution.

Parameterize the notebook

Adding hyperparameter

Parameterizing a notebook happens through cell tags. Tags are a standard Jupyter feature.

Here we mark the first cell with a parameters tag, which means all variables are considered to be Valohai parameters, just like you would define in the valohai.yaml.

Download the inputs

Adding parameterized input

Here we marked the first cell with inputs tag and ran it in Valohai.

All the variables in this cell will be considered as Valohai input URIs for the execution, just like in the valohai.yaml.

Reusing the parameterized notebook

Adding hyperparameter

Now you can run notebook based experiments without a notebook!

Because the learning_rate is parameterized, you can change it via Valohai web interface and run additional experiments without even opening the notebook.