Data for building custom model – Vertex AI Custom Model Hyperparameter and Deployment
For this exercise data is downloaded from Kaggle (link is provided further down) and the dataset is listed under CC0: Public domain licenses. Data contains various measurements from EEG and the state of the eye is captured via the camera. 1 indicates closed eye and 0 indicates open eye.
https://www.kaggle.com/datasets/robikscube/eye-state-classification-eeg-dataset
hpo_vertex-ai bucket is created under us-centra1 (single region) and .CSV file is uploaded from to the bucket as shown in Figure 5.1:
Figure 5.1: Data uploaded to cloud storage
Custom model building with hyperparameter tuning activity is done in multiple steps (very similar to the exercise of previous chapter with a few more additional steps). We will be developing a Random forest classifier using Sklearn package.
Follow the steps given in the previous chapter for creation of the workbench, but instead of choosing TensorFlow enterprise machine while creating, choose Python3 machine.
Step 1: Landing page of workbench
Landing page of the workbench as shown in the Figure 5.2:
Figure 5.2: Creation of workbench
Now follow the corresponding points:
- Click New Notebook.
- Select Python 3.
- In the next pop up, provide the name for the workbench and select the region to be us-central1 and click Create.
Step 2: Notebook creation complete
It will take few mins to complete the creation of notebook and Al the Jupyter lab instance. Once it loads, we will see the screen shown in Figure 5.3.
- Click OPEN JUPYTERLAB:
Figure 5.3: Workbench successfully created
Launch the Terminal (refer to Figure 4.6 in the previous chapter, point no. 11).
Step 1: Directory creation
Figure 5.4 illustrated creation of a directory in the workbench:
Figure 5.4: Directory creation in the terminal
Follow the corresponding points:
- Type the following commands one after the other in the Terminal window. We create a new directory called eye, and create Dockerfile inside the eye directory:
mkdir eye
cd eye
touch Dockerfile
- The Dockerfile will be created inside the eye folder. This file will have no contents; double click on the file to open it.
Step 2: Edit Dockerfile
To edit Dockerfile, follow the given steps:
- Enter the following commands in the Dockerfile, as shown in the Figure 5.5:
FROM gcr.io/deeplearning-platform-release/sklearn-cpu
WORKDIR /
RUN pip install cloudml-hypertune
COPY trainer /trainer
ENTRYPOINT [“python”,”-m”,”trainer.task”]
Figure 5.5: Editing Dockerfile
- cloudml-hypertune package will not be available, and so it needs to be installed while creating the docker image, line number 3 in the former code installs the package while creating.
- Save the Dockerfile and close the file.
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