模型階段

MLflow 入門

Weston Bassler

Senior MLOps Engineer

軟體環境

開發、測試與正式環境的示意圖

MLflow 入門

MLflow 模型階段

  • 指派給模型版本
  • 預先定義的階段:

    • None
    • Staging
    • Production
    • Archived
  • 同一時間僅能有一個階段

MLflow 入門

預設階段

預設階段

MLflow 入門

None

None 階段

MLflow 入門

Staging

Staging 階段

MLflow 入門

Production

Production 階段

MLflow 入門

Archived

Archived 階段

MLflow 入門

模型轉換

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" )
MLflow 入門

將模型版本轉為 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>
MLflow 入門

Registry UI

註冊表 UI

MLflow 入門

轉換為 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>
MLflow 入門

一起來練習吧!

MLflow 入門

Preparing Video For Download...