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

Tinder bio generation with OpenAI GPT-3 API

Introduction: Recently I got access to OpenAI API beta. After a few simple experiments, I set on creating a simple test project. In this project, I will try to create good tinder bio for a specific person.  The abc of openai API playground: In the OpenAI API playground, you get a prompt, and then you can write instructions or specific text to trigger a response from the gpt-3 models. There are also a number of preset templates which loads a specific kind of prompt and let's you generate pre-prepared results. What are the models available? There are 4 models which are stable. These are: (1) curie (2) babbage (3) ada (4) da-vinci da-vinci is the strongest of them all and can perform all downstream tasks which other models can do. There are 2 other new models which openai introduced this year (2021) named da-vinci-instruct-beta and curie-instruct-beta. These instruction models are specifically built for taking in instructions. As OpenAI blog explains and also you will see in our

Can we write codes automatically with GPT-3?

 Introduction: OpenAI created and released the first versions of GPT-3 back in 2021 beginning. We wrote a few text generation articles that time and tested how to create tinder bio using GPT-3 . If you are interested to know more on what is GPT-3 or what is openai, how the server look, then read the tinder bio article. In this article, we will explore Code generation with OpenAI models.  It has been noted already in multiple blogs and exploration work, that GPT-3 can even solve leetcode problems. We will try to explore how good the OpenAI model can "code" and whether prompt tuning will improve or change those performances. Basic coding: We will try to see a few data structure coding performance by GPT-3. (a) Merge sort with python:  First with 200 words limit, it couldn't complete the Write sample code for merge sort in python.   def merge(arr, l, m, r):     n1 = m - l + 1     n2 = r- m       # create temp arrays     L = [0] * (n1)     R = [0] * (n

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