Build a custom ML model with Vertex AI

Google Cloud Tech
25 Jun 202110:55

TLDRIn this video, Priyanka Vergadia guides viewers through building a custom machine learning model with Vertex AI to predict vehicle fuel efficiency. The process involves creating a Python training application or custom container, utilizing pre-built or custom containers, and leveraging Vertex AI's hyperparameter tuning service. The video demonstrates packaging training code in a Docker container and deploying the trained TensorFlow model for predictions, showcasing the flexibility of Vertex AI for various machine learning frameworks.

Takeaways

  • 🚀 **Custom ML Model Development**: The video discusses building custom machine learning models using Vertex AI, specifically for predicting vehicle fuel efficiency.
  • 🛠️ **Python Training Application**: To create a custom job, a Python training application or custom container with the training code and dependencies is required.
  • 📋 **Pre-built Containers**: Vertex AI offers pre-built containers for popular ML frameworks like TensorFlow, scikit-learn, XG Boost, and PyTorch.
  • 🔧 **Custom Container Option**: For specific needs, one can build custom containers and provide their location from a container or artifact registry.
  • 🔍 **Hyperparameter Tuning**: Vertex AI's hyperparameter tuning service optimizes model training by searching for the best combination of hyperparameters across multiple trials.
  • 💻 **Compute Resources**: Training on Vertex AI can utilize single-node or multi-worker pools with various machine configurations, including CPUs, disk sizes, and accelerators like GPUs.
  • 🚀 **Model Deployment**: After training, the model can be served using pre-built containers or custom ones stored in a container registry or artifact registry.
  • 📈 **TensorFlow Example**: The video provides a step-by-step guide on using TensorFlow to build a model, packaging it in a Docker container, and deploying it on Vertex AI.
  • 🔗 **Google Cloud Services**: The process involves enabling Vertex AI API, Compute Engine, and Container Registry APIs, and using Google Cloud services for model storage and deployment.
  • 📱 **Endpoint Predictions**: Once the model is deployed as an endpoint, it can be used to make predictions from any environment using the Vertex AI Python SDK.
  • 🎥 **Continuous Learning**: The video series will continue with a focus on building a vision model using auto ML in the next episode.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is building a custom machine learning model with Vertex AI and walking through the process of training and deploying the model.

  • Who is the presenter of the video?

    -The presenter of the video is Priyanka Vergadia.

  • What does Fuel Symbol want to predict with their custom machine learning model?

    -Fuel Symbol wants to predict the fuel efficiency of a vehicle with their custom machine learning model.

  • What are the pre-built containers available for running the training code in Python?

    -The pre-built containers available for running the training code in Python include TensorFlow, scikit-learn, XG Boost, and PyTorch.

  • How can you utilize Vertex's hyperparameter tuning service?

    -You can utilize Vertex's hyperparameter tuning service by creating trials of your training job with different sets of hyperparameters and searching for the best combination across those trials.

  • What type of compute resources can be used for training on Vertex AI?

    -For training on Vertex AI, you can use either single-node or multiple worker pools for distributed training, including different types of machines, CPUs, disk sizes, disk types, and accelerators like GPUs.

  • How is the trained model served for predictions in Vertex AI?

    -The trained model is served for predictions in Vertex AI by using pre-built containers that support runtime such as TensorFlow, scikit-learn, and PyTorch, or by building your own custom container.

  • What is the first step in creating a custom training job on Vertex AI?

    -The first step in creating a custom training job on Vertex AI is to create a Python training application or custom container to write the training code and the dependencies.

  • How can you check the progress of the custom model training job?

    -You can check the progress of the custom model training job in the Vertex AI console under the 'Training' tab.

  • What framework was used to build the model for Fuel Symbol?

    -TensorFlow was used to build the model for Fuel Symbol.

  • How is the training code packaged for the custom model?

    -The training code is packaged in a Docker container for the custom model.

Outlines

00:00

🚀 Introduction to Custom Machine Learning Models in Vertex AI

The video begins with Priyanka Vergadia introducing the concept of custom machine learning models in Vertex AI. She explains that the previous episodes focused on creating datasets and training machine learning models using auto ML. The current episode aims to assist Fuel Symbol in developing a custom machine learning model to predict vehicle fuel efficiency. The process involves understanding how to run custom training in Vertex AI and the requirements for creating a custom job, such as developing a Python training application or custom container, utilizing pre-built containers for Python applications with TensorFlow, scikit-learn, XG Boost, or PyTorch, and the need for a Cloud Storage bucket to store model output artifacts. Additionally, the video touches on the use of Vertex AI's hyperparameter tuning service and the selection of compute resources for training. The summary highlights the importance of preparing the necessary components, such as training code and dependencies, before submitting custom jobs to Vertex AI.

05:02

🛠️ Setting Up Custom Training with Docker and Google Cloud

This paragraph details the process of setting up a custom training environment using Docker and Google Cloud services. It begins with creating a Docker file that uses a deep learning container image from Google Cloud, which comes preloaded with common machine learning frameworks like TensorFlow Enterprise, Pandas, and scikit-learn. The script then guides the user to set up a Cloud Storage bucket for exporting the trained TensorFlow model and to create a 'train.py' file within a 'trainer' directory, where the training code is written. The summary emphasizes the adaptation of the code from TensorFlow docks to predict fuel efficiency and the necessity of updating the bucket variable with the storage bucket's name. It also explains the local testing of the container and the process of pushing it to Google Container Registry to make it accessible for Vertex AI. The paragraph concludes with the initiation of a custom model training job in Vertex AI, explaining the selection of 'No managed datasets' and the use of custom containers for training. It also discusses the Compute and Pricing options, the Prediction Container setup, and the training process's monitoring.

10:05

🔄 Deploying the Trained Model and Making Predictions

The final paragraph of the script covers the deployment of the trained model and the process of making predictions. After the model is trained, it needs to be deployed to an endpoint for prediction services. The video demonstrates how to name the model and set up the traffic split and compute nodes for the endpoint. It also explains that deploying the endpoint may take a few minutes and how to monitor its progress in the Endpoint tab. Once deployed, the video proceeds to show how predictions can be made using the Vertex AI Python SDK from a Python notebook. The summary highlights the installation of the SDK, the creation of a Python 3 notebook, and the steps to make a prediction with test data. The video concludes with a brief mention of the next episode's content, which will focus on building a vision model using auto ML, and encourages viewers to engage in discussions and follow for updates.

Mindmap

Keywords

💡Vertex AI

Vertex AI is a cloud-based platform for machine learning developed by Google. It provides various tools and services to help users build, train, and deploy machine learning models. In the video, Vertex AI is the primary platform where the custom machine learning model for predicting vehicle fuel efficiency is built and trained.

💡Custom Machine Learning Models

Custom Machine Learning Models refer to models that are specifically designed and coded by a user or a team of machine learning experts to solve a particular problem. In the context of the video, Fuel Symbol's team decides to write their own training code to predict the fuel efficiency of vehicles, which is an example of creating a custom machine learning model.

💡Python Training Application

A Python Training Application is a software program written in Python that is used to train machine learning models. It includes the training code and necessary dependencies. In the video, Priyanka Vergadia explains that before submitting custom jobs to Vertex AI, a Python training application or custom container needs to be created to write the training code and include the required dependencies.

💡Pre-built Containers

Pre-built Containers are pre-configured software environments that include all the necessary libraries and dependencies for running a specific task, such as machine learning training. In the video, it is mentioned that Vertex AI provides pre-built containers for running Python code using TensorFlow, scikit-learn, XG Boost, or PyTorch, which simplifies the process of training models.

💡Hyperparameter Tuning

Hyperparameter Tuning is the process of adjusting the non-learnable parameters of a machine learning model to improve its performance. These parameters control aspects of the training process, such as batch size or the number of hidden layers in a neural network. In the video, it is explained that Vertex AI offers a hyperparameter tuning service that runs multiple trials of a training job with different hyperparameters to find the best combination.

💡Compute Resources

Compute Resources refer to the hardware and software resources required to perform computations, such as processing power (CPUs), memory, and storage. In the context of the video, compute resources are necessary for training the machine learning model, and the user can choose between single-node or multiple worker pools for distributed training.

💡TensorFlow

TensorFlow is an open-source machine learning framework developed by Google. It is widely used for building and training machine learning models. In the video, TensorFlow is the chosen framework for building the custom model to predict fuel efficiency of vehicles, and the training code is packaged into a Docker container.

💡Docker Container

A Docker Container is a lightweight, standalone, and executable package of software that includes everything needed to run an application, such as code, runtime, system tools, libraries, and settings. In the video, the training code is packaged in a Docker container, which is then pushed to Google Container Registry to be accessed by Vertex AI for the custom model training job.

💡Cloud Storage Bucket

A Cloud Storage Bucket is a storage location on a cloud service provider's network where users can store and retrieve data. In the video, a Cloud Storage bucket is used to store the trained TensorFlow model as output artifacts, which can then be read by Vertex AI for model deployment.

💡Endpoint

In the context of machine learning, an Endpoint refers to a network address or a location where the trained model is hosted and can be accessed for making predictions. In the video, after the model is trained, it is deployed to an endpoint using pre-built containers in Vertex AI, allowing for the model to serve predictions.

💡Vertex AI Python SDK

The Vertex AI Python SDK (Software Development Kit) is a set of tools and libraries provided by Google to interact with Vertex AI services using Python. It allows users to manage and use Vertex AI features, such as deploying models and making predictions, in a Python environment. In the video, the Vertex AI Python SDK is used in a Jupyter Notebook to make predictions on the trained model from the endpoint.

Highlights

Learn how to create custom machine learning models with Vertex AI.

Discover the process of predicting vehicle fuel efficiency using custom ML models.

Understand the requirements for submitting custom jobs to Vertex AI, including Python training applications and custom containers.

Explore the use of pre-built containers for popular ML frameworks like TensorFlow, scikit-learn, XG Boost, and PyTorch.

Get insights on how to utilize Vertex AI's hyperparameter tuning service for optimizing model performance.

Find out how to select compute resources for training, including single-node or distributed worker pools.

Learn about deploying trained models as endpoints for predictions using pre-built or custom containers.

Follow the step-by-step guide to build a Docker container for your custom training code.

Get started with Google Cloud console by enabling necessary APIs and creating a new notebook instance.

Adapt existing TensorFlow code to predict fuel efficiency using the auto MPG dataset from Kaggle.

Create a Cloud Storage bucket for exporting your trained TensorFlow model.

Understand how to build and test your container locally before deploying it to the cloud.

See how to push your custom container to Google Container Registry for Vertex AI access.

Follow the process of initiating a custom model training job in Vertex AI.

Explore the options for serving your model through pre-built containers and Cloud Storage buckets.

Deploy your model to an endpoint and learn how to make predictions using the Vertex AI Python SDK.

Get a sneak peek at the next video where a vision model will be built using auto ML.