Databricks Machine Learning Professional Question 146
Select 2You are working on a machine learning project in Databricks, and you need to load a registered model from the Databricks Model Registry for inference. Which of the following statements about loading the model using mlflow.pyfunc.load_model() or mlflow.<flavor>.load_model() is correct?
- A
You can load a specific version of a registered model using the format 'models:/<model_name>/
'. - B
You can load the latest version of a registered model in the 'Production' stage by specifying 'models:/<model_name>/Production'.
- C
The function
mlflow.pyfunc.load_model()cannot be used to load registered models; it is only for local model files. - D
It is mandatory to specify the absolute path to the model file when using
mlflow.<flavor>.load_model().
Show answer and explanation
Correct answers: A, B
Explanation
In Databricks, you can load registered models from the Model Registry using the mlflow.pyfunc.load_model() or mlflow.<flavor>.load_model() functions. These functions allow you to specify the model URI in the format 'models:/<model_name>/
- A. Correct.
This is correct.
mlflow.pyfunc.load_model()andmlflow.<flavor>.load_model()support loading a specific version of a model from the Databricks Model Registry using the 'models:/<model_name>/' format. - B. Correct.
This is correct. You can load the latest version of a model in a specific stage (e.g., 'Production') by specifying the model URI format 'models:/<model_name>/
'. - C. Incorrect.
This is incorrect.
mlflow.pyfunc.load_model()can indeed be used to load models from the Databricks Model Registry, as well as local files or remote URIs. - D. Incorrect.
This is incorrect. When loading models from the Databricks Model Registry, you use the 'models:/' URI format, and it is not mandatory to specify an absolute path to the model file.