Training with Jupyter Notebook

Training using the alwaysAI Jupyter Notebook adds a graphical interface to training a model. You can track how the model is improving during training by watching the plot of loss and validation loss per step. This guide details how to run training using Jupyter and contains the following sections:

  1. Jupyter Training Command

  2. Launch The Jupyter Notebook

  3. Configure Training

  4. Begin Training

  5. Training Complete

  6. Continue Training with Jupyter

Jupyter Training Command

To train a model using jupyter simply add the jupyter flag to the training command

$ ... --jupyter

An example of the entire command

$ aai dataset train /path/to/dataset.zip --jupyter

Launch The Jupyter Notebook

Running training using the jupyter flag launches a Notebook on your localhost and provides you three different ways to access the Notebook with the browser of your choice. There are two URLs composed of a way to access your localhost and port plus a token for the current session and a way to do the same thing using the file system. We provide these options to account for system variability. Use the one that works for you.

image

After pasting the URL of your choice, you will see the Jupyter Labs interface. Double-click the file named Notebook.ipynb. This brings up the alwaysAI model training notebook.

image

From the toolbar, click the start symbol twice, as shown in the image below. This will bring up the configuration interface.

image

Configure Training

The current configuration options allow you to set when validation of training occurs as well as how often training loss is plotted. Use the text input box to enter the number of steps to train before validating the model’s learning. The default value is 1, meaning that the progress of the model will be validated after every step. Keep in mind that this validation takes time and resources, so we recommend that you don’t validate every step.

image

Begin Training

Press the Begin Training button to start training the model. This brings up the graph that plots the loss for every step. The scale of the plot corresponds to the total number of steps that was defined in the training command.

Training Complete

Once training is done, you will see a green check mark below the plot. This tells you that the steps have been run, and the model is complete. To finish the process, click ‘Shut Down Notebook’ and close the browser to officially end training. The model will be exported just as if trained through the CLI. See our documentation on model training output and post model training for further guidance.

image

Your model will be available to continue training from, use locally or publish, the same as when training using the CLI.

Continue Training with Jupyter

If you would like to train your model further, you can use the --continue-from-version flag. When you add this flag, you also need to add the --id flag, indicating which model you are continuing from, like so

$ aai dataset train path/to/dataset_zipped.zip --id <username/modelname> --continue-from-version <version> --jupyter

Note: Also, once the Notebook is spun up, make sure to enter the total number of steps you wish your model to be trained on, which is equal to the total amount previously trained plus the new number of steps.

You will see the plotting continue from the previous training, with output similar to the image below

image