Install TorchStudio

Download the installer corresponding to your platform:

Download

Run it and once installed launch TorchStudio and let it install a local PyTorch environment on your computer by clicking Install:

Load and analyze the MNIST dataset

The first tab you’ll see is the Dataset tab.

Select the torchvision.datasets category, and the MNIST dataset. This dataset is composed of handwritten digits and their corresponding interpretation.

Then click Load. If you don’t already have this dataset on your computer, it will be automatically downloaded.

Once your dataset is loaded, you’ll be able to explore it (change the value of Sample 0 to see other samples).

Optionally click Analyze to produce an analysis report of this dataset.

Build and train a MNIST classifier model

Click the plus button at the top, next to the Dataset tab. This will create your first model.

Select the torchstudio.models category, and the MNISTClassifier model:

Then click Build. If you don’t already have this dataset on your computer, it will be automatically downloaded.

Once the model is built, you’ll be able to see its Graph representation (how nodes are connected internally, from the top input to the bottom output).

Notice that for now, the AI model is unable to make a correct interpretation of the handwritten digit. While the Input display shows a 5, the Output display gives an almost equal probability for all interpretations.

Now click Train to start training the model.

After a few minutes you’ll see the Metric plot increase (bottom right panel), meaning the model is properly training and makes more and more accurate interpretations. You’ll also notice that the handwritten digits in the Input display are correctly interpreted in the Output display.

That’s it ! You’ve trained your first AI model.

Save the result

You can now click Stop Training, and save your project by clicking menu > Save Project or export your trained model by clicking menu > Export Model… (select either the TorchScript or ONNX format).

Tutorials