Giới thiệu về MLflow Model Registry

Giới thiệu về MLflow

Weston Bassler

Senior MLOps Engineer

Vòng đời mô hình

Sơ đồ development, staging

Giới thiệu về MLflow

MLflow Model Registry

  • Kho lưu trữ tập trung

  • Quản lý vòng đời

    • Web UI
    • Mô-đun MLflow Client
    • Phiên bản mô hình
    • Giai đoạn mô hình

model-registry

Giới thiệu về MLflow

MLflow Model Registry

  • Model

    • Được ghi log vào MLflow Tracking
  • Registered Model

    • Có phiên bản
    • Có thể gán giai đoạn
Giới thiệu về MLflow

MLflow Model Registry

  • Model Version

    • Tăng mỗi khi đăng ký mô hình mới
  • Model Stage

    • Có thể gán một trong:
      • None
      • Staging
      • Production
      • Archived

Giai đoạn

Giới thiệu về MLflow

Làm việc với Model Registry

Mô hình

Giới thiệu về MLflow

Mô-đun MLflow Client

  • Experiments

  • Runs

  • Model Versions

  • Registered Models

Học máy

1 Flaticon.com
Giới thiệu về MLflow

Dùng mô-đun 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>
Giới thiệu về MLflow

Đăng ký một mô hình

# 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={}>
Giới thiệu về MLflow

Giao diện Model (UI)

create-model

Giới thiệu về MLflow

Tìm kiếm mô hình đã đăng ký

search-models

Giới thiệu về MLflow

Tìm kiếm mô hình đã đăng ký

# Search for registered models
client.search_registered_models(filter_string=MY_FILTER_STRING)
  • Định danh
    • name - tên mô hình
    • tags - thẻ gắn với mô hình
  • Toán tử so sánh
    • = - bằng
    • != - khác
    • LIKE - khớp mẫu phân biệt hoa thường
    • ILIKE - khớp mẫu không phân biệt hoa thường
Giới thiệu về MLflow

Ví dụ tìm kiếm

# 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={}>]
Giới thiệu về MLflow

Ayo berlatih!

Giới thiệu về MLflow

Preparing Video For Download...