Building awesome machine learning models can be an onerous task. Once all the blood, sweat and tears have been expended creating this magical (and ethical) model sometimes it feels like getting the thing deployed will require severing another limb in the name of releasing software. This post is designed to help you, dear reader, manage the land mines surrounding this complicated task and hopefully make this part of the development cycle painless.
Here’s the rundown:
- I made a machine learning model in PyTorch that classifies tacos vs burrito images
- I exported the model to ONNX
- I want to deploy inferencing code to Azure Functions using Python
- I’ve been able to get the function running locally (this can be its own post but I thought the docs were excellent).
What follows is my journey getting this to work (with screenshots to boot). Let’s dig in!
Let’s say you built an amazingly wonderful hand-crafted artisanal convolutional neural network that works beautifully on your hard-drive based dataset. You are now ready to take this masterpiece to the cloud to work on a much larger dataset on beefier machines - you are not looking forward to it.
- “How do I ship this patchwork conda (or venv) where I’ve installed everything the training/inference code needed AS WELL AS everything else I thought I needed along the way?”
- “I don’t want to waste cloud compute money on things I’m not sure will work on the first try!!”
- Basically, “I have already done the work and I’m not interested in the yak shaving portion of the job!”
No need to fear, dear reader, this article is designed to help you move your glorious work to the cloud (and beyond) by leveraging your local environment as if it were the cloud itself.
Making software is hard. Every once in a while we find some code that really helps the process. It makes our own code intelligible: almost fun! Sometimes the magical code is of our own making but often we are using someone else’s code. In either case the next step should be to share the joy.
My preferred mechanism to share the joy is through videos. Videos are a powerful way of humanizing the types of problems software solves. With video, you can get in the thick of it code-wise while still adding a literal face. You can see the excitement, the technology, and most importantly: the code.