モデルのステージ

MLflow 入門

Weston Bassler

Senior MLOps Engineer

ソフトウェア環境

開発・ステージング・本番の環境図

MLflow 入門

MLflow のモデルステージ

  • モデルのバージョンに割り当て
  • 事前定義ステージ

    • None
    • Staging
    • Production
    • Archived
  • 同時に持てるステージは1つのみ

MLflow 入門

事前定義ステージ

事前定義ステージ

MLflow 入門

None

None ステージ

MLflow 入門

Staging

Staging ステージ

MLflow 入門

本番

本番ステージ

MLflow 入門

アーカイブ済み

アーカイブ済みステージ

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 入門

レジストリ UI

レジストリ UI

MLflow 入門

本番への移行

# 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...