Introduction to MLflow Model Registry

Introduction to MLflow

Weston Bassler

Senior MLOps Engineer

Model lifecycle

Diagram of development, staging

Introduction to MLflow

MLflow Model Registry

  • Centralized storage location

  • Lifecycle management

    • Web UI
    • MLflow Client module
    • Model versions
    • Model stages

model-registry

Introduction to MLflow

MLflow Model Registry

  • Model

    • Model logged to MLflow Tracking
  • Registered Model

    • Obtains version
    • Stage eligible
Introduction to MLflow

MLflow Model Registry

  • Model Version

    • Increments with each new registered model
  • Model Stage

    • Can be assigned one of:
      • None
      • Staging
      • Production
      • Archived

Stages

Introduction to MLflow

Working with the Model Registry

Models

Introduction to MLflow

MLflow Client module

  • Experiments

  • Runs

  • Model Versions

  • Registered Models

Machine Learning

1 Flaticon.com
Introduction to MLflow

Using MLflow client module

# Import from MLflow module
from mlflow import MlflowClient


# Create an instance client = MlflowClient()
# Print the object client
<mlflow.tracking.client.MlflowClient object at 0x101d55f30>
Introduction to MLflow

Registering a model

# Create a Model named "Unicorn"
client.create_registered_model(name="Unicorn")
<RegisteredModel: creation_timestamp=1679404160448, description=None, 
last_updated_timestamp=1679404160448, latest_versions=[], name='Unicorn', 
tags={}>
Introduction to MLflow

Model UI

create-model

Introduction to MLflow

Searching registered models

search-models

Introduction to MLflow

Searching registered models

# Search for registered models
client.search_registered_models(filter_string=MY_FILTER_STRING)
  • Identifiers
    • name - of the model
    • tags - tags associated with model
  • Comparators
    • = - equal to
    • != - not equal to
    • LIKE - case-sensitive pattern match
    • ILIKE - case-insensitive pattern match
Introduction to MLflow

Example search

# Filter string
unicorn_filter_string = "name LIKE 'Unicorn%'"


# Search models client.search_registered_models(filter_string=unicorn_filter_string)
[<RegisteredModel: creation_timestamp=1679404160448, description=None, 
last_updated_timestamp=1679404160448, latest_versions=[], name='Unicorn', 
tags={}>, 
<RegisteredModel: creation_timestamp=1679404276745, description=None, 
last_updated_timestamp=1679404276745, latest_versions=[], name='Unicorn 2.0', 
tags={}>]
Introduction to MLflow

Let's practice!

Introduction to MLflow

Preparing Video For Download...