MLflow Model Registry 簡介

MLflow 入門

Weston Bassler

Senior MLOps Engineer

模型生命週期

開發、Staging 的流程圖

MLflow 入門

MLflow Model Registry

  • 集中化儲存位置

  • 生命週期管理

    • 網頁 UI
    • MLflow Client 模組
    • 模型版本
    • 模型階段

model-registry

MLflow 入門

MLflow Model Registry

  • Model(模型)

    • 已記錄到 MLflow Tracking
  • Registered Model(已註冊模型)

    • 取得版本
    • 可指派階段
MLflow 入門

MLflow Model Registry

  • 模型版本

    • 每次註冊新模型會遞增
  • 模型階段

    • 可指派下列之一:
      • None
      • Staging
      • Production
      • Archived

階段

MLflow 入門

使用 Model Registry

Models

MLflow 入門

MLflow Client 模組

  • Experiments(實驗)

  • Runs(執行)

  • Model Versions(模型版本)

  • Registered Models(已註冊模型)

Machine Learning

1 Flaticon.com
MLflow 入門

使用 MLflow client 模組

# Import from MLflow module
from mlflow import MlflowClient


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

註冊模型

# 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={}>
MLflow 入門

模型 UI

create-model

MLflow 入門

搜尋已註冊模型

search-models

MLflow 入門

搜尋已註冊模型

# Search for registered models
client.search_registered_models(filter_string=MY_FILTER_STRING)
  • 識別項
    • name-模型名稱
    • tags-與模型相關的標籤
  • 比較子
    • =-等於
    • !=-不等於
    • LIKE-區分大小寫的樣式比對
    • ILIKE-不區分大小寫的樣式比對
MLflow 入門

搜尋範例

# 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={}>]
MLflow 入門

一起來練習吧!

MLflow 入門

Preparing Video For Download...