QuestionQ96

VerifiedAdvanced MLflow Usage

A Machine Learning Engineer must develop a custom PyFunc model that needs external configuration files and pre-trained weights stored in Unity Catalog volumes. The model must be registered in Unity Catalog with catalog name production, schema ml_models, and model name text_classifier. The engineer has the required USE CATALOG, USE SCHEMA, and CREATE MODEL privileges on the target schema. The configuration file is at /Volumes/production/ml_models/configs/model_config.json, and the weights file is at /Volumes/production/ml_models/weights/model.pk1. They must log the custom PyFunc model with the required artifacts and register it in Unity Catalog.

Which code approach accomplishes this?

Explanation

mlflow.pyfunc.log_model() supports custom PyFunc models and an artifacts parameter for packaging external configuration and weight files with the model. Passing the full Unity Catalog name production.ml_models.text_classifier through registered_model_name registers the logged model directly in Unity Catalog. Creating that registered model requires USE CATALOG, USE SCHEMA, and CREATE MODEL privileges on the target schema.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!