📝 Guest post: How to Build an ML Platform from Scratch*
Was this email forwarded to you? Sign up here In TheSequence Guest Post, our partners explain what ML and AI challenges they help deal with. In this article, Alon Gubkin, CTO of Aporia, discusses a proper ML infrastructure and offers a guide on how to build one using open-source tools. How to Build an ML Platform from ScratchAs your data science team grows and you start deploying models to production, the need for proper ML infrastructure – and a standard way to design, train and deploy models – becomes crucial. In this guide, we will build a basic ML Platform using open-source tools like Cookiecutter, DVC, MLFlow, FastAPI, Pulumi and more. We’ll also see how to monitor for model drift using Aporia. Final code is available on GitHub. Keep in mind that this type of project can be huge – often taking a lot of time and resources – therefore, our toy ML Platform won’t have tons of features – just the basics, but it should teach you the basic principles of how to build your own ML platform. Our toy ML Platform will use DVC for data versioning, MLFlow for experiments management, FastAPI for model serving, and Aporia for model monitoring. We’re going to build all of this on top of AWS, but in theory, you could also use Azure, Google Cloud, or any other cloud provider. It’s important to note that when building your own machine learning platform, you should NOT take these tools for granted. You should evaluate alternatives – as they may be more appropriate for your specific use case and business needs. Model TemplateThe first component in our machine learning platform is the model template, which we’ll build using Cookiecutter for templating, and Poetry for package management. The idea is that when a data scientist starts working on a new project, they will clone our model template (which contains a standard folder structure, Python linting, etc.), develop their model, and easily deploy it when it’s ready for production. The ML models template will contain basic training and serving code. Data & Experiment TrackingThe training code in the model template will use the MLFlow client to track experiments. Those experiments will be sent to the MLFlow Server that we’ll run on top of Kubernetes (EKS). The model artifact itself will be saved in an S3 Bucket (the Artifact Storage), and metadata about experiments will be saved in a PostgreSQL database. We’ll also track versions of the dataset using DVC in an S3 bucket. Model ServingFor model serving, we’ll build a FastAPI server responsible for preprocessing, making predictions, etc. These model servers are going to run on Kubernetes, and we’ll expose them to the internet using Traefik. Infrastructure as CodeAll our infrastructure is going to be deployed using Pulumi, an Infrastructure-as-Code tool similar to Terraform. If you aren’t familiar with the concept, you can read more about it before continuing. Here are some major advantages of using this method:
With Pulumi, you can choose to write your infrastructure in a real programming language, such as TypeScript, Python, C#, and more. Even though the natural choice for an ML platform would be Python, I chose TypeScript because, at the time of writing this post, Pulumi’s implementation of TypeScript is more feature complete. Repositories & CI/CDWe’re going to have 2 GitHub repositories:
For CI/CD, we’re going to use GitHub Actions. Model MonitoringWe’ll now set up a data drift monitor using Aporia. You can play with Aporia using the free community edition with Aporia cloud or install it on Kubernetes using Pulumi. Start by creating a free account. Once in the platform, click the “Add Model” button on the Models Management dashboard. Follow the instructions to integrate your model. Then, you’ll be able to define monitors for Model Drift, Performance Degradation, and more. Get started!If you prefer to follow a 2-hour live coding session, check out this YouTube video I made for the MLOps.community. Or you can read the complete how-to guide here. Have fun! *This post was written by Alon Gubkin, CTO of Aporia. We thank Aporia for their ongoing support of TheSequence.You’re on the free list for TheSequence Scope and TheSequence Chat. For the full experience, become a paying subscriber to TheSequence Edge. Trusted by thousands of subscribers from the leading AI labs and universities. |
Older messages
💻 Another NVIDIA AI Week
Sunday, March 27, 2022
Weekly news digest curated by the industry insiders
🧠 Edge#176: Meta’s New Architecture for Build AI Agents that Can Reason Like Humans and Animals
Thursday, March 24, 2022
The new architecture provides the foundation for autonomous AI agents.
📝 Guest post: You are probably doing MLOps at a reasonable scale. Embrace it*
Wednesday, March 23, 2022
No subscription is needed
👩🏼🎨 Edge#175: Understanding StyleGANs
Tuesday, March 22, 2022
+open-sourced StyleGANS for generating photorealistic synthetic images
📌 Remember in-person events? This one’s worth the wait
Monday, March 21, 2022
After a two-year hiatus, Rev is back. The most ambitious Enterprise MLOps conference is coming to New York City May 5-6. We're bringing the data science community together in-person for a one-of-a-
You Might Also Like
🔒 The Vault Newsletter: November issue 🔑
Monday, November 25, 2024
Get the latest business security news, updates, and advice from 1Password. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
🧐 The Most Interesting Phones You Didn't See in 2024 — Making Reddit Faster on Older Devices
Monday, November 25, 2024
Also: Best Black Friday Deals So Far, and More! How-To Geek Logo November 25, 2024 Did You Know If you look closely over John Lennon's shoulder on the iconic cover of The Beatles Abbey Road album,
JSK Daily for Nov 25, 2024
Monday, November 25, 2024
JSK Daily for Nov 25, 2024 View this email in your browser A community curated daily e-mail of JavaScript news JavaScript Certification Black Friday Offer – Up to 54% Off! Certificates.dev, the trusted
Ranked | How Americans Rate Business Figures 📊
Monday, November 25, 2024
This graphic visualizes the results of a YouGov survey that asks Americans for their opinions on various business figures. View Online | Subscribe Presented by: Non-consensus strategies that go where
Spyglass Dispatch: Apple Throws Their Film to the Wolves • The AI Supercomputer Arms Race • Sony's Mobile Game • The EU Hunts Bluesky • Bluesky Hunts User Trust • 'Glicked' Pricked • One Massive iPad
Monday, November 25, 2024
Apple Throws Their Film to the Wolves • The AI Supercomputer Arms Race • Sony's Mobile Game • The EU Hunts Bluesky • Bluesky Hunts User Trust • 'Glicked' Pricked • One Massive iPad The
Daily Coding Problem: Problem #1619 [Hard]
Monday, November 25, 2024
Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. Given two non-empty binary trees s and t , check whether tree t has exactly the
Unpacking “Craft” in the Software Interface & The Five Pillars of Creative Flow
Monday, November 25, 2024
Systems Over Substance, Anytype's autumn updates, Ghost's progress with its ActivityPub integration, and a lot more in this week's issue of Creativerly. Creativerly Unpacking “Craft” in the
What Investors Want From AI Startups in 2025
Monday, November 25, 2024
Top Tech Content sent at Noon! How the world collects web data Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, November 25, 2024? The HackerNoon
GCP Newsletter #426
Monday, November 25, 2024
Welcome to issue #426 November 25th, 2024 News LLM Official Blog Vertex AI Announcing Mistral AI's Large-Instruct-2411 on Vertex AI - Google Cloud has announced the availability of Mistral AI's
⏳ 36 Hours Left: Help Get "The Art of Data" Across the Finish Line 🏁
Monday, November 25, 2024
Visual Capitalist plans to unveal its secrets behind data storytelling, but only if the book hits its minimum funding goal. View Online | Subscribe | Download Our App We Need Your Help Only 36 Hours