vertex-ai-mlops
vertex-ai-mlops copied to clipboard
Google Cloud Platform Vertex AI end-to-end workflows for machine learning operations
Vertex AI for Machine Learning Operations
👋 I'm Mike
I want to share and enable Vertex AI from Google Cloud with you. The goal here is to share a comprehensive set of end-to-end workflows for machine learning that each cover the range of data to model to serving and managing - even automating the flow. Regardless of your data type, skill level or framework preferences you will find something helpful here.
Click to watch on YouTube
Click here to see full playlist for this repository
Considerations
Data Type
- Tables: Tabular, structured data in rows and columns
- Language: Text for translation and/or understanding
- Vision: Images
- Video
Convenience Level
- Use Pre-Trained APIs
- Automate building Custom Models
- End-to-end Custom ML with core tools in the framework of your choice
Framework Preferences
Overview
This is a series of workflow demonstrations that use the same data source to build and deploy the same machine learning model with different frameworks and automation. These are meant to help get started in understanding and learning Vertex AI and provide starting points for new projects.
The demonstrations focus on workflows and don't delve into the specifics of ML frameworks other than how to integrate and automate with Vertex AI. Let me know if you have ideas for more workflows or details to include!
To understand the contents of this repository, the following charts uncover the groupings of the content.
| Direction |
:-------------------------:
This work focuses on cases where you have training date:
| Overview |
:-------------------------:
AutoML | BigQuery ML | Vertex AI | Forecasting with AutoML, BigQuery ML, OSS Prophet |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Vetex AI
Vetex AI is a platform for end-to-end model development. It consist of core components that make the processes of MLOps possible for design patterns of all types.
Interacting with Vertex AI
Many Vertex AI resources can be viewed and monitored directly in the GCP Console. Vertex AI resources are primarily created, modified, with the Vertex AI API. The API is accessible from the command line with gcloud ai
, REST, gRPC, or the client libraries (built on top of gRPC) for Python, Java, and Node.js.
There are additional API versions available: v1: stable, v1beta: latest preview features. The Vertex AI Python client library is called the Vertex AI SDK for Python.
The notebooks in this repository primarily use the Python client with first preference being the aiplatform
library and occasional use of aiplatform_v1
and aiplatform_v1beta1
.
Install the Vertex AI Python Client
pip install google-cloud-aiplatform
Import Vertex AI Python Client versions
from google.cloud import aiplatform
from google.cloud import aiplatform_v1
from google.cloud import aiplatform_v1beta1
Recommendation When reviewing the code in this repository it is recommended to first consult the Python Client Reference and the look for futher details in the Vertex AI SDK for Python.
More on using Python with Google Cloud
- A complete list of Google Cloud Python Client Libraries
- Getting started with Python in Google Cloud
Setup
The demonstrations are presented in a series of JupyterLab notebooks. These can be reviewed directly in this repository on GitHub or cloned to your Jupyter instance on Vertex AI Workbench.
Option 1: Review files directly
Select the files and review them directly in the browser or IDE of your choice. This can be helpful for general understanding and selecting sections to copy/paste to your project.
Option 2: Run These Notebooks in a Vertex AI Workbench based Notebook
TL;DR
In Google Cloud Console, Select/Create a Project then go to Vertex AI > Workbench > User-Managed Notebooks
- Create a new notebook and Open JupyterLab
- Clone this repository using Git Menu, Open and run
00 - Environment Setup.ipynb
- Create a Project
- Link, Alternatively, go to: Console > IAM & Admin > Manage Resources
- Click "+ Create Project"
- Provide: name, billing account, organization, location
- Click "Create"
- Enable the APIs: Vertex AI API and Notebooks API
-
Link
- Alternatively, go to:
- Console > Vertex AI, then enable API
- Then Console > Vertex AI > Workbench, then enable API
- Alternatively, go to:
-
Link
- Create A Notebook
- Link, Alternatively, go to: Console > Vertex AI > Workbench
- Click User-Managed Notebooks
- Click "+ Create Notebook" or "+ New Notebook"
- Selections:
- Tensorflow Enterprise > Tensorflow Enterprise 2.3 > Without GPUs
- Provide: name, region = us-central1, machine type = n1-standard-4
- some options may be under "Advanced Options"
- Click "Create"
- Open JupyterLab Notebook Instance
- Once the Notebook Instance is started click the "Open JupyterLab" link
- Clone This Repository to the Notebook Instance
- Use the Git Menu at the top or on the left navigation bar to select "Clone a Repository"
- Provide the Clone URI of this repository: https://github.com/statmike/vertex-ai-mlops.git
- In the File Browser you will now have the folder "vertex-ai-mlops" that contains the files from this repository
- Setup the Notebook Environment for these workflows
- Open the notebook vertex-ai-mlops/00 - Environment Setup
- Follow the instructions and run the cells
Resources on these items:
- Google Cloud Projects
- Vertex AI environment
- Introduction to Notebooks
- Create a Notebooks Instance
- Open Notebooks
Learning Machine Learning
I often get asked "How do I learn about ML?". There are lots of good answers. I do have a preferred answer that is offered here. I believe in a broad understanding of the topic, terminology, problem framing and method selection while also building up fundamental understandings of how everything actually works.
- Good overview with terminology, methods, problem framing, and tips for using APIs from TensorFlow. The Machine Learning Crash Course
- Strong Introduction to Fundamentals with Andrew Ng offered by Stanford on Coursera. Machine Learning
- Pull it all together with excellent walk-throughs of the core concepts from the Youtube channel 3Blue1Brown
- Neural Networks playlist
- Essence of linear algebra playlist
- Essence of calculus playlist
This is a good review order: 1, 3.1, 3.2, 3.3, 2, 3.1 (again!). When done with this, remember you are a beginner so begin, have fun, make mistakes and keep optimizing your cost function to boost your knowledge!
A good next step is to use the curriculums curated by the Tensorflow community. These are great at balancing coding, math & stats, theory, and project based learning.
More Resources Like This Repository
This is my personal repository of demonstrations I use for learning and sharing Vertex AI. There are many more resources available. Within each notebook I have included a resources section and a related training section.
- GitHub GoogleCloudPlatform/vertex-ai-samples
- GitHub GoogleCloudPlatform/mlops-with-vertex-ai
- Overview of Data Science on Google Cloud
Vertex AI For ML Training
Add these:
- tensorboard
- experiment
- worker pool
sequenceDiagram
actor User
participant Training Code
participant API
participant Training Job
Participant Custom Job
Participant Hyperparameter Tuning Job
Note over Training Job, Hyperparameter Tuning Job: Vertex AI Training
rect rgb(154, 160, 166)
note right of User: Vertex AI Workbench / Notebook
Training Code ->> Training Code: Inside
end
rect rgb(234, 67, 53)
note right of User: Python Script
rect rgb(66, 133, 244)
note right of Training Code: a
Training Code ->> API: customJob = aiplatform.CustomJob.from_local_script()
API ->> Custom Job: customJob.run()
end
rect rgb(251, 188, 4)
note right of Training Code: d
Training Code ->> API: trainingJob = aiplatform.CustomTrainingJob()
API ->> Training Job: model = trainingJob.run()
Training Job -->> Custom Job: creates backing custom job
end
rect rgb(52, 168, 83)
note right of Training Code: g
Training Code ->> API: customJob = aiplatform.CustomJob.from_local_script()
Training Code ->> API: tuningJob = aiplatform.HyperparameterTuningJob(customJob)
API ->> Hyperparameter Tuning Job: tuningJob.run()
end
end
rect rgb(234, 67, 53)
note right of User: Python Source Distribution
rect rgb(66, 133, 244)
note right of Training Code: b
Training Code ->> API: customJob = aiplatform.CustomJob()
API ->> Custom Job: customJob.run()
end
rect rgb(251, 188, 4)
note right of Training Code: e
Training Code ->> API: trainingJob = aiplatform.CustomPythonPackageTrainingJob()
API ->> Training Job: model = trainingJob.run()
Training Job -->> Custom Job: creates backing custom job
end
rect rgb(52, 168, 83)
note right of Training Code: h
Training Code ->> API: customJob = aiplatform.CustomJob
Training Code ->> API: tuningJob = aiplatform.HyperparameterTuningJob(customJob)
API ->> Hyperparameter Tuning Job: tuningJob.run()
end
end
rect rgb(234, 67, 53)
note right of User: Custom Container
rect rgb(66, 133, 244)
note right of Training Code: c
Training Code ->> API: customJob = aiplatform.CustomJob()
API ->> Custom Job: customJob.run()
end
rect rgb(251, 188, 4)
note right of Training Code: f
Training Code ->> API: trainingJob = aiplatform.CustomContainerTrainingJob()
API ->> Training Job: model = trainingJob.run()
Training Job -->> Custom Job: creates backing custom job
end
rect rgb(52, 168, 83)
note right of Training Code: i
Training Code ->> API: customJob = aiplatform.CustomJob()
Training Code ->> API: tuningJob = aiplatform.HyperparameterTuningJob(customJob)
API ->> Hyperparameter Tuning Job: tuningJob.run()
end
end