This repository demonstrates how to train a machine learning model using the MPG dataset and deploy it on Google Cloud's Vertex AI. The process includes environment setup, Docker containerization of training code, and deployment for custom training on Vertex AI.
- Google Cloud SDK
- Docker
- Python 3.x
Authenticate with Google Cloud:
gcloud auth login
gcloud config set project [YOUR_PROJECT_ID]
export PROJECT_ID=[YOUR_PROJECT_ID]
export BUCKET_NAME=gs://${PROJECT_ID}-bucket
export IMAGE_URI=gcr.io/$PROJECT_ID/mpg:v1
gsutil mb -l [REGION] $BUCKET_NAME
docker build ./ -t $IMAGE_URI
docker run $IMAGE_URI
docker push $IMAGE_URI
- Navigate to Vertex AI in Cloud Console:
- Go to the Models section in Vertex AI. Create a Training Job:
- Set up the training job with the custom container image ($IMAGE_URI).
- Specify the machine type and other settings.
- Use the pre-built prediction container and set the model output path to your GCS bucket.
- Once the training job is complete, deploy the trained model to an endpoint in Vertex AI.
- Use the deployed endpoint for making predictions with
prediction.py
.