Skip to main content

introduction to MLOps: what and why?

 Prelogue:

Recently kdNuggets published this poll survey depicting that one of the hottest skills is MLOps nowadays. Although I knew ML Ops is devOps for ML; but knowing that one line is clearly lacking as a data scientist. And boy that's not good for my career. So buckle your seats as I take you through my internet voyage through knowing basics of ML Ops.

Introduction:

To begin with, one must read the awesome intro to ML Ops written by google clouds. This awesome article first introduces the concept of CI/CD/CT. which are respectively continuous integration, continuous delivery and the last option being specific to ml models: continuous training. 
This post then goes on to define each of terms and establishes the facts that ml code is actually a very small part of a data science exercise; with starting from product designing and data storage; to data validation, data fetching, model deployment and many more concepts actually come together to create the whole picture of ml practice in a company. 
After that this article mainly talks about 
(1) 0 level ml ops: 
static model development in offline and then deployment
(2) 1 level ml ops: 
dynamic model development pipeline with two main tracks of modeling; one of which continuously gathers more and more data from the online traffic and then builds new data to re-train the model automatically in the CT(continuous training) pipeline. 
The second pipeline is the manual model training track; which starts the original CT track the first time by providing source code related to model as well as feature stores and other relevant resources. 
This second and manual track gets triggered automatically from the automated track whenever data shows pattern changes, features fail in various tests and so on. The above mentioned article describes all that very well.
(3) level 2 ml ops:
This is the most advanced stage of ml ops. In this stage, the continous integration is also automated. i.e. the manual track we were talking about above is actually translated into an semi-automatic pipeline. 
In this new pipeline, once the data scientist employs the changes in parameter, algorithms or some other specifications; the integration ( testing of the model, validation, test case performance check of packages written ) is done automatically and then the model is checked with the last version of it in terms of accuracy and other similar performance metrics. And finally the CD is also automatically completed.
This level of ml ops scaling, gives data scientists much time to actually change and experiment their models in vast variety and then come up with better results rather than wasting time with repeating similar tasks in the manual track.

How to start with such pipeline in your work?

For this, I will read the referred articles one by one. From this article, you will get a basic idea of how to create a ci/cd pipeline for your own data-flow. I will summarize the article in fewer words; as a gist; to keep up the continuity of our current post.
This second post, actually introduces us to the google cloud platform and aims to teach 
(1) cloud build (2) cloud composer and (3) data flow

With these 3 tools, we can supposedly build data pipelines for automatic CI/CD. Let's see how we do that. Before beginning of the tutorial itself, google describes the tools like cloud build, cloud composer and data flow.
 
Before all that, just let's look at this picture and get intimidated for sometimes.

 
Now that we are properly intimidated; google will slowly describe why you don't need to be. 
Basically you can consider the CI/CD pipeline as a small packaging and loading line in a delivery bay.
Imagine 3 people standing; A,B and C.
A takes a new fresh product, packages it under a nice box, gives it to B. 
B checks the box strength, size, product labels and other things and also writes a delivery instruction on the top of the box; finally giving it to C.
C takes this checked product and finally as B tells he loads the product on the truck; which ships for customers.
 
Now, in CI/CD pipeline, absolutely the same thing is happening. 
Here, 
First new product arrival refers to new commit in code repository in the cloud.
A being the cloud build; creates a JAR ( java archive which I don't know what it is) file using Maven builder and tests the JAR build by automatic java test cases.
Then it uploads it to test JAR bucket in a cloud storage; which is later picked up by C for running the workflow.
Here B is also cloud build itself, which now additional to creating the automated running build ( a good question to ask here is what is technical definition of a build, will answer later), it also 
sets variables in cloud composer to refer to new JAR build.(writing delivery instructions) 
And finally it also triggers the test files stored in cloud storage, as cloud build deploys the test files and test the newly built workflow.
Finally the cloud composer, runs the workflow using the JAR and workflow DAG.

Here there are a bunch of terms which I am just taking as it is but not explaining. These are: 
maven builder, JAR, build and DAG.

I will go through these later after I get a handle of what is happening.

Now, after explaining all these, we enter to the main tutorial.

Before entering the main tutorial you actually see the google cloud platform for the first time. It is a whole new ball game; and looks like this:
 


Now I will try and explore a few things in the google cloud platform, as it is free for first timers for starting 3 months. I plan to put those exploration in a separate post entirely on google cloud exploration. 

Now for the build, composer and storage understanding we will enter into the main tutorial. make sure:
(1) you have also opened your project like this
(2) enabled APIs
(3) last but not least verified the billing


Main tutorial and begining of the code: 

I am still working on this portion of the post. I know, you are like, what takes you so long? well I will come back tomorrow and update this more. Upto that point, stay tuned with me to learn MLOps with me.

Comments

Popular posts from this blog

Mastering SQL for Data Science: Top SQL Interview Questions by Experience Level

Introduction: SQL (Structured Query Language) is a cornerstone of data manipulation and querying in data science. SQL technical rounds are designed to assess a candidate’s ability to work with databases, retrieve, and manipulate data efficiently. This guide provides a comprehensive list of SQL interview questions segmented by experience level—beginner, intermediate, and experienced. For each level, you'll find key questions designed to evaluate the candidate’s proficiency in SQL and their ability to solve data-related problems. The difficulty increases as the experience level rises, and the final section will guide you on how to prepare effectively for these rounds. Beginner (0-2 Years of Experience) At this stage, candidates are expected to know the basics of SQL, common commands, and elementary data manipulation. What is SQL? Explain its importance in data science. Hint: Think about querying, relational databases, and data manipulation. What is the difference between WHERE

What is Bort?

 Introduction: Bort, is the new and more optimized version of BERT; which came out this october from amazon science. I came to know about it today while parsing amazon science's news on facebook about bort. So Bort is the newest addition to the long list of great LM models with extra-ordinary achievements.  Why is Bort important? Bort, is a model of 5.5% effective and 16% total size of the original BERT model; and is 20x faster than BERT, while being able to surpass the BERT model in 20 out of 23 tasks; to quote the abstract of the paper,  ' it obtains performance improvements of between 0 . 3% and 31%, absolute, with respect to BERT-large, on multiple public natural language understanding (NLU) benchmarks. ' So what made this achievement possible? The main idea behind creation of Bort is to go beyond the shallow depth of weight pruning, connection deletion or merely factoring the NN into different matrix factorizations and thus distilling it. While methods like knowle

Spacy errors and their solutions

 Introduction: There are a bunch of errors in spacy, which never makes sense until you get to the depth of it. In this post, we will analyze the attribute error E046 and why it occurs. (1) AttributeError: [E046] Can't retrieve unregistered extension attribute 'tag_name'. Did you forget to call the set_extension method? Let's first understand what the error means on superficial level. There is a tag_name extension in your code. i.e. from a doc object, probably you are calling doc._.tag_name. But spacy suggests to you that probably you forgot to call the set_extension method. So what to do from here? The problem in hand is that your extension is not created where it should have been created. Now in general this means that your pipeline is incorrect at some level.  So how should you solve it? Look into the pipeline of your spacy language object. Chances are that the pipeline component which creates the extension is not included in the pipeline. To check the pipe eleme