Model stages

Introduzione a MLflow

Weston Bassler

Senior MLOps Engineer

Software envrironments

Diagram of development, staging, and production environments

Introduzione a MLflow

MLflow model stages

  • Assigned to model versions
  • Predefined stages:

    • None
    • Staging
    • Production
    • Archived
  • One single stage at a time

Introduzione a MLflow

Predefined stages

Predefined Stages

Introduzione a MLflow

None

None Stage

Introduzione a MLflow

Staging

Staging stage

Introduzione a MLflow

Production

Production stage

Introduzione a MLflow

Archived

Archived stage

Introduzione a MLflow

Transitioning models

transition-ui

# Import MLFlow Client
from mlflow import MlflowClient
client = MlflowClient()

# Transition to Staging client.transition_model_version_stage( name="Unicorn", version=3, stage="Staging" )
Introduzione a MLflow

Transition model version staging

# Transition to Staging
client.transition_model_version_stage(name="Unicorn", version=3, stage="Staging")
<ModelVersion: creation_timestamp=1679693470034, current_stage='Staging', 
description=None, last_updated_timestamp=1679699050734, name='Unicorn', 
run_id='a1454f2865e449f8835f38f71e53e547', run_link=None, 
source='./mlruns/1/a1454f2865e449f8835f38f71e53e547/artifacts/model', 
status='READY', status_message=None, tags={}, user_id=None, version=3>
Introduzione a MLflow

Registry UI

staging-ui

Introduzione a MLflow

Transitioning to production

# Transition to Production
client.transition_model_version_stage(name="Unicorn", version=3, 
                                      stage="Production")
<ModelVersion: creation_timestamp=1679693470034, current_stage='Production', 
description=None, last_updated_timestamp=1679699633297, name='Unicorn', 
run_id='a1454f2865e449f8835f38f71e53e547', run_link=None, 
source='./mlruns/1/a1454f2865e449f8835f38f71e53e547/artifacts/model', 
status='READY', status_message=None, tags={}, user_id=None, version=3>
Introduzione a MLflow

Let's practice!

Introduzione a MLflow

Preparing Video For Download...