Databricks Generative AI Engineer Associate Question 183
Select 4You are tasked with deploying a PyFunc model in Databricks for a machine learning pipeline. The model requires a pre-processing step to format the input data and a post-processing step to transform the model's output into a human-readable format. Which of the following steps are necessary to correctly implement and deploy this chain?
- A
Define a Python function for pre-processing and integrate it into the PyFunc model’s wrapper class.
- B
Directly call the PyFunc model without implementing pre- or post-processing steps, as Databricks handles this automatically.
- C
Define the post-processing logic as a separate Python function and integrate it into the PyFunc model’s wrapper class.
- D
Ensure the PyFunc model wrapper handles both pre- and post-processing within its predict() method.
- E
Use the MLflow library to log the PyFunc model with the custom wrapper class.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
When deploying a PyFunc model in Databricks, pre- and post-processing steps must be explicitly implemented within a custom PyFunc model wrapper class. The pre-processing ensures that input data is correctly formatted for the model, while post-processing transforms the output into a human-readable or usable format. These steps are typically handled in the wrapper class's predict() method. MLflow is used to log and manage the model for deployment in Databricks.
- A. Correct.
Correct. Pre-processing logic should be implemented as part of the custom PyFunc model's wrapper class to ensure the input data is correctly formatted before model inference.
- B. Incorrect.
Incorrect. Databricks does not automatically handle pre- and post-processing. These steps must be explicitly implemented in the custom PyFunc model.
- C. Correct.
Correct. Post-processing logic needs to be integrated into the PyFunc model's wrapper class to transform the output into a desired format.
- D. Correct.
Correct. The predict() method of the PyFunc model wrapper should handle both pre- and post-processing to ensure a streamlined inference pipeline.
- E. Correct.
Correct. MLflow is used to log the custom PyFunc model, enabling its deployment and usage in Databricks.