Get startedGet started for free

MLOps and workflow automation

1. MLOps and workflow automation

SPEAKER: In this lesson, you explore an advanced topic, MLOps and workflow automation. You learned from the previous lessons to build an ML model through three main stages-- data preparation, model development, and model serving. You have two approaches to build an end-to-end workflow. One is codeless through Google Cloud Console, like AutoML on Vertex AI. But what if you want to automate this workflow to achieve continuous integration, training, and delivery? Here comes the other option, to code a pipeline that automates the ML workflow. Machine learning operations, or MLOps, play a big role. MLOps combines machine learning development with operations and applies similar principles from DevOps, or Development Operations, to machine learning models. MLOps aims to solve production challenges related to machine learning. In this case, this refers to building an integrated machine learning system and operating it in production. These are considered to be some of the biggest pain points by the ML practitioners community, because both data and code are constantly evolving in machine learning. Practicing MLOps means automating and monitoring each step of the ML system construction to enable continuous integration, training, and delivery. The backbone of MLOps on Vertex AI is a toolkit called Vertex AI Pipelines. This toolkit supports both Kubeflow Pipelines, or KFP, and TensorFlow Extended, or TFX. If you already use TensorFlow to build ML models that process terabytes of structured data, it makes sense to use TFX and turn that code into an ML pipeline. Otherwise, KFP can be a good alternative. Learn more about how to choose between the Kubeflow Pipelines SDK and TFX from the reading list. An ML pipeline contains a series of processes and runs in two different environments. First is the experimentation, development, and test environment. And second is the staging, pre-production, and production environment. In the development environment, you start from data preparation, which includes data extraction, analysis, and preparation, to model development like training, evaluation, and validation. The result is a trained model that can be entered in the model registry. Once the model is trained, the pipeline moves to the staging and production environment, where you serve the model, which includes prediction and monitoring. Each of these processes can be a pipeline component, which is a self-contained set of code that performs one task of a workflow. You can think of a component as a function, which is a building block of a pipeline. You can either build a custom component on your own, or leverage the pre-built components provided by Google. If you want to accomplish a specific task to tailor your ML workflow, such as determining a special threshold for model deployment, you may need to code a custom component. Before doing so, check the pre-built components offered by Google Cloud. You may find a pipeline component to reuse or customize to suit your needs. Learn more about using Google Cloud pipeline components in your pipeline in the reading list. All these components are like pieces on an ML pipeline. You need to assemble them together to automate the entire ML workflow. Organizations often implement ML automation in three phases. Phase 0 is the starting point where you have not configured any MLOps. You typically use the graphical user interface or GUI-based workflow, such as AutoML for training, deployment, and serving. Phase 0 is critical because it helps you build an end-to-end workflow manually before you automate it. In Phase 1, you start automating your ML workflow by building components using the Vertex AI pipelines' SDKs. An example of a component would be the training pipeline. It is in this phase that you develop the building blocks for future use. In phase 2, you integrate the separate components to form an entire workflow and to achieve CI, CT and CD. Let's look at an example. Assume you want to build a pipeline to train, evaluate, and deploy an AutoML model that classifies beans into one of seven types based on their characteristics. You have two main steps-- build a pipeline and then run it. To build a pipeline, you first plan it as a series of components, which can be a combination of custom and pre-built. To promote reusability, each component should have a single responsibility. Second, you build any custom components that are needed. For example, you create a component called classification model eval metrics. You use this component to compare the evaluation metrics to a threshold after the model is trained and determine whether the model should be deployed. If the model performs well, you deploy it. Otherwise, you retrain the model. Third, you assemble the pipeline by adding pre-built components. For example, TabularDatasetCreateOp creates a tabular data set in Vertex AI, given a data set source, either in Cloud Storage or BigQuery. AutoMLTabularTrainingJobRunOp kicks off an AutoML training job for a tabular data set. EndpointCreateOp creates an endpoint in Vertex AI. And ModelDeployOp deploys a given model to an endpoint in Vertex AI. You also include a custom component from the previous step, classification model eval metrics, to compare the performance of the trained model to a threshold. After the pipeline is built, you must compile and run it. First you compile it using the compiler, compiler.Compiler.compile, or compile commands. And then you define and run the pipeline job. The good news is you don't have to create a pipeline from the beginning. Vertex AI provides a few templates, like the one for classification or regression of tabular data with AutoML to help you start your journey. Now you have an automated pipeline to train, evaluate, and deploy an ML model. This pipeline will check the performance of the model constantly and decide whether it should be deployed or retained without your intervention. The nice thing is that Google Cloud also visualizes the pipeline based on the coding, with which you can easily check the components and the corresponding artifacts. This example demonstrated the overall process to build a pipeline. To know more about pipeline details, please practice with the coding example in the demo, "Introduction to Vertex AI Pipelines," which is available in the reading list for this course.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.