PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #186
You have recently trained a scikit-learn model that you plan to deploy on Vertex AI. This model will support both online and batch prediction. You need to preprocess input data for model inference…
The correct answer is B. 1. Wrap your model in a custom prediction routine (CPR). and build a container image from the. To deploy a scikit-learn model on Vertex AI for online and batch prediction with custom preprocessing and minimal code, wrap the model in a Custom Prediction Routine (CPR).
Question
Options
- A
- Upload your model to the Vertex AI Model Registry by using a prebuilt scikit-ieam prediction
- B
- Wrap your model in a custom prediction routine (CPR). and build a container image from the
- C
- Create a custom container for your scikit learn model.
- D
- Create a custom container for your scikit learn model.
How the community answered
(28 responses)- A4% (1)
- B71% (20)
- C18% (5)
- D7% (2)
Why each option
To deploy a scikit-learn model on Vertex AI for online and batch prediction with custom preprocessing and minimal code, wrap the model in a Custom Prediction Routine (CPR).
Using a prebuilt scikit-learn prediction container typically assumes input data is already in the expected format for the model and does not easily accommodate custom preprocessing logic without further modification or a custom handler.
A Custom Prediction Routine (CPR) allows you to define a `Predictor` class with custom preprocessing logic, model inference, and post-processing. Vertex AI then uses this to build a container image, embedding your custom code and minimizing the boilerplate container setup required, which is ideal for incorporating preprocessing with minimal effort.
Creating a fully custom container requires writing a complete Dockerfile and serving script, which involves significantly more code and effort compared to leveraging a Custom Prediction Routine that abstracts much of the containerization boilerplate.
This choice is a duplicate of C and, similarly, involves more manual effort for container creation and setup than using a Custom Prediction Routine for embedding custom logic.
Concept tested: Vertex AI Custom Prediction Routines, model deployment with preprocessing
Source: https://cloud.google.com/vertex-ai/docs/predictions/custom-prediction-routines
Topics
Community Discussion
No community discussion yet for this question.