Image creation – Vertex AI Workbench and Custom Model Training-1
Now that we have completed the creation of Dockerfile and Python code for the model building. We can proceed with image creation.
Step 1: Image creation using docker build
Type the following commands as shown in Figure 4.19 for image creation:
IMAGE_URL=”gcr.io/$PROJECT_ID/price:v1”
docker build ./ -t $IMAGE_URL
Figure 4.19: Image creation process
- Type the commands in the Terminal.
It will take a few minutes to build the image from the Dockerfile. Once the build is complete, success message will be displayed in the terminal as shown in Figure 4.20:
Figure 4.20: Image creation complete
- Success message after completion of image creation.
Step 2: Checking the docker image
After creation of the image, let us check if we can run the python code from the image created. Type the command given below as shown in Figure 4.21:
docker run $IMAGE_URL
Figure 4.21: Test run of python code on container
- Type the command.
Python code has run successfully as shown in the following figure:
Figure 4.22: Successful run of code
Pushing image to container registry
Now that we have created the image and tested if the code runs with proper output, we can now push the image to the container registry.
Step 1: Image push command
Type the following command in the Terminal as shown in Figure 4.23:
docker push $IMAGE_URL
Figure 4.23: Image to project container registry
- Type the command.
- Image successfully pushed to the container registry.
Step 2: Check container registry
Open the container registry from the navigation menu of the platform (it will be listed under CI/CD). Alternatively, type container registry in the search box of the platform to open it. Landing page of container registry is as shown in Figure 4.24:
Figure 4.24: Created price folder in container registry
- A folder called price will be created in the container registry (Refer to the image creation where we have specified price to be the name and v1 to be the tag). Click on price.
Figure 4.25: Created image pushed to container registry
- Image will be available inside the folder and under tag v1.
Submitting the custom model training job
For the model to get trained, it picks the data from the .csv which is uploaded on the cloud storage bucket. By default, workbench resources will have a read and write access to the cloud storage. However, when we submit the job for training, training code will execute on one or more Google Cloud-managed VM instances. These VM will not have access to the cloud storage buckets and hence we will use the service account. Follow these steps to submit the training job:
Step 1: Training module of vertex AI
Open the training module of the vertex AI as shown in Figure 4.26:
- Select training module.
- Select custom jobs.
- Click CREATE.
You may also like
Archives
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- September 2023
- August 2023
- June 2023
- May 2023
- April 2023
- February 2023
- January 2023
- November 2022
- October 2022
- September 2022
- August 2022
- June 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
Calendar
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Leave a Reply