Notebooks - Azure-Samples/locutus GitHub Wiki

In the "Scaling responsible MLOps with Azure Machine Learning" breakout session you saw Abe working with several notebooks. This will guide you through how to set those up.

Setup

Head over to ml.azure.com and click on the "Notebooks" feature:

Notebooks

Once there create a new folder to store all of our work:

Create Folder

Perform the following actions:

  1. Create a new folder
  2. Upload model.ipynb file and train.ipynb using the "Upload Files" feature
  3. Create a folder called "data"
  4. Upload the data files (6130-0.txt, homer.json, and pg1727.txt)

When done your file structure should look like this:

File Structure

Initial Model

Once you open up the model.ipynb file make sure you set the kernel to Python 3.8 - Pytorch and Tensorflow:

Notebook Kernel

After setting the kernel you should be able to run the entire notebook (this one only takes a few minutes):

Model Notebook

Finetuning

The train.ipynb notebook has the code to finetune GPT-2 using the Iliad and the Odyssey written by Homer. The training takes about 2 hours to complete end-to-end and looks something like this when running (make sure to select the Python 3.8 - Pytorch and Tensorflow kernel as described above):

Training Notebook

Summary

In this exercise you ran two notebooks that downloaded and executed the GPT-2 model from HuggingFace. Then you finetuned the model with the writings of Homer.