4. Model is an overloaded term with several meanings in MLflow:
● Native model - simply the native flavor’s serialized format. For sklearn it’s a pickle file, for TensorFlow it’s a
directory with SaveModel format files.
● MLflow model - wrapper around the native model with metadata in the MLmodel file and environment
information in conda.yaml and requirements.txt files. Lives in an MLflow run.
● Model version
○ Wrapper around an MLflow model of which there are two:
■ The source run's MLflow model used for UI and lineage purposes - lives in workspace.
■ A copy of the run's MLflow model that lives in model registry storage. For UC it lives in UC storage, for non-UC it lives
in the workspace locked-down DBFS.
● Registered model - a bucket of model versions.
See MLflow documentation page Components of a Model in MLflow
Meanings of a Model
5. MLflow Object Relationships - Overview
● Model Version - points to a Run
● Run points to:
○ MLflow Model - contains:
■ Native Model
■ Metadata in MLmodel file
■ Python library dependencies
○ Notebook code:
■ Notebook revision in workspace
■ Git link (if applicable)
○ Delta Table - Captured in several ways:
■ Run.inputs aka mlflow.data
■ Run tag sparkDatasourceInfo
(undocumented)
6. MLflow Object Relationships - Details
● Native Model- native model’s serialized format, e.g. pickle
file
● MLflow Model - metadata wrapper around native model
● Run - Contains MLflow model + params and metrics
● ModelVersion- deployable unit in registry pointingto an
MLflow model
● RegisteredModel - bucketof model versions
● Experiment - bucket of runs
7. MLflow Object Relationships - Class Diagram
● An experiment can have 0 or more runs
● A run can belong to only one experiment
● A run can have 0 or more MLflow models
● A model version points to one run
● A run can be linked to one or more model versions
● A registered model can 0 or more model versions
● A model version can belong to only one registered model
8. MLOps Pipeline - Model First - Unity Catalog
Workflowsteps
1. Dev environment
1a. Train model
1b. Register best model in dev catalog
1b. Copy MLflow run to staging workspace
2. Staging environment
2a. Run model evaluation and non-ML code tests
2b. Copy (promote) model version to staging catalog
2c. Copy model version to prod catalog when ready
2c. Copy MLflow run to prod workspace for lineage and governance
3. Prod environment - run model inference ondata
12. ● Copies a model version and its run (optional).
● Two types of model version copy:
○ Shallow copy - does not copy the source version's run. The destination model version will point to the source
version's run.
○ Deep copy - the destination model version will point to a new copy of the run in the destination workspace.
■ Recommended for full governance and lineage tracking.
● Supports both the WS registry and UC registry copying including WS to UC copying.
● For WS registry, the destination model version can be either in the same workspace or in another workspace.
● For UC registry, the destination model version can be either in the same UC metastore or in another UC metastore.
● Databricks registry URIs should be Databricks profiles.
● Note MLflow 2.8.0 introduced MlflowClient.copy_model_version. However it is only a shallow copy and does not work
across external workspaces or UC metastores.
● Source:
○ Copy_Model_Version.py - Python script
○ Copy_Model_Version - Databricks notebook
Copy Model Version Details
13. Copy Model Version - Script - Examples
copy-model-version
--src-model dev.models.sklearn_wine
--src-version 1
--dst-model prod.models.sklearn_wine
--dst-experiment-name /Users/first.last@mycompany.com/My_Experiment
--src-registry-uri: databricks-uc://test-env
--dst-registry-uri: databricks-uc://test-env
Copy UC model version in the same UC metastore
Copy UC model version to another UC metastore
copy-model-version
--src-model dev.models.sklearn_wine
--src-version 1
--dst-model prod.models.sklearn_wine
--dst-experiment-name /Users/first.last@mycompany.com/My_Experiment
--src-registry-uri: databricks-uc://test-env
--dst-registry-uri: databricks-uc://prod-env
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
What did they do with us?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
What did they do with us?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
What did they do with us?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
What did they do with us?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
What did they do with us?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?
what are they trying to do? recommendation? content curation?
how does that work?
How come Delta and Spark and those things can help with that thing (recommendation, or whatever they do)?