📝 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. |
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
Import AI 399: 1,000 samples to make a reasoning model; DeepSeek proliferation; Apple's self-driving car simulator
Friday, February 14, 2025
What came before the golem? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
Defining Your Paranoia Level: Navigating Change Without the Overkill
Friday, February 14, 2025
We've all been there: trying to learn something new, only to find our old habits holding us back. We discussed today how our gut feelings about solving problems can sometimes be our own worst enemy
5 ways AI can help with taxes 🪄
Friday, February 14, 2025
Remotely control an iPhone; 💸 50+ early Presidents' Day deals -- ZDNET ZDNET Tech Today - US February 10, 2025 5 ways AI can help you with your taxes (and what not to use it for) 5 ways AI can help
Recurring Automations + Secret Updates
Friday, February 14, 2025
Smarter automations, better templates, and hidden updates to explore 👀 ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
The First Provable AI-Proof Game: Introducing Butterfly Wings 4
Friday, February 14, 2025
Top Tech Content sent at Noon! Boost Your Article on HackerNoon for $159.99! Read this email in your browser How are you, @newsletterest1? undefined The Market Today #01 Instagram (Meta) 714.52 -0.32%
GCP Newsletter #437
Friday, February 14, 2025
Welcome to issue #437 February 10th, 2025 News BigQuery Cloud Marketplace Official Blog Partners BigQuery datasets now available on Google Cloud Marketplace - Google Cloud Marketplace now offers
Charted | The 1%'s Share of U.S. Wealth Over Time (1989-2024) 💰
Friday, February 14, 2025
Discover how the share of US wealth held by the top 1% has evolved from 1989 to 2024 in this infographic. View Online | Subscribe | Download Our App Download our app to see thousands of new charts from
The Great Social Media Diaspora & Tapestry is here
Friday, February 14, 2025
Apple introduces new app called 'Apple Invites', The Iconfactory launches Tapestry, beyond the traditional portfolio, and more in this week's issue of Creativerly. Creativerly The Great
Daily Coding Problem: Problem #1689 [Medium]
Friday, February 14, 2025
Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. Given a linked list, sort it in O(n log n) time and constant space. For example,
📧 Stop Conflating CQRS and MediatR
Friday, February 14, 2025
Stop Conflating CQRS and MediatR Read on: my website / Read time: 4 minutes The .NET Weekly is brought to you by: Step right up to the Generative AI Use Cases Repository! See how MongoDB powers your