Training and deploying your PyTorch model in the cloud with Azure ML

Beatriz Stollnitz
PyTorch
Published in
10 min readNov 15, 2022

--

Photo by Vladimir Anikeev on Unsplash

You’ve been training your PyTorch models on your machine, and getting by just fine. Why would you want to train and deploy them in the cloud? Training in the cloud will allow you to handle larger ML models and datasets than you could train on your development machine. And deploying your model in the cloud will allow your system to scale to many more inference requests than a development machine could handle. In short, moving your code to the cloud will open up a new world of possibilities by scaling up the hard work you’ve already done.

The good news is that moving your PyTorch models to the cloud using Azure ML is fairly straightforward. In this article, I will show you how to train and deploy a simple Fashion MNIST model in the cloud. The steps you’ll see here are the same regardless of the complexity of your PyTorch model, so by the end of this article you’ll be well prepared to apply them to your own work.

You can find the project associated with this post on GitHub, including complete instructions on how to run it.

Step 1: Train and test your PyTorch model locally

You’re probably already done with this step. I added it here anyway because I can’t emphasize enough that your model should be working as expected before…

--

--

Beatriz Stollnitz
PyTorch

Bea Stollnitz is a principal developer advocate at Microsoft, focusing on Azure OpenAI, Azure ML, and other AI/ML technologies.