工作流程

MLflow 入門

Weston Bassler

Senior MLOps Engieer

MLflow 專案

工作流程

1 unsplash.com
MLflow 入門

MLproject

name: project_name
python_env: python_env.yaml
entry_points:

step_1: command: "python train_model.py"
step_2: command: "python evaluate_model.py {run_id}" parameters: run_id: type: str default: None
MLflow 入門

工作流程

import mlflow

# Step 1
step_1 = mlflow.projects.run(
    uri='./',
    entry_point='step_1'
)

# Step 2 step_2 = mlflow.projects.run( uri='./', entry_point='step_2' )
MLflow 入門

執行專案

import mlflow

# Step 1
step_1 = mlflow.projects.run(
    uri='./',
    entry_point='step_1'
)

print(step_1)
<mlflow.projects.submitted_run.LocalSubmittedRun object at 0x125eac8b0>
MLflow 入門

執行專案

step_1.cancel() - 終止目前的執行

step_1.get_status() - 取得執行狀態

step_1.run_id - 此次執行的 run_id

step_1.wait() - 等待執行完成

MLflow 入門

執行專案

import mlflow

# Step 1
step_1 = mlflow.projects.run(
    uri='./',
    entry_point='step_1'
)

# 設定 step_1 的 run_id 變數 step_1_run_id = step_1.run_id
# Step 2
step_2 = mlflow.projects.run(
    uri='./',
    entry_point='step_2',

parameters={ 'run_id': step_1_run_id }
)
MLflow 入門

ML 生命週期

模型工程與模型評估

MLflow 入門

一起來練習吧!

MLflow 入門

Preparing Video For Download...