Giới thiệu về MLflow Projects

Giới thiệu về MLflow

Weston Bassler

Senior MLOps Engineer

MLflow Projects

  • Tái lập

  • Tái sử dụng

  • Di động

Tăng tốc năng suất

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

MLproject

project/
    MLproject
    train_model.py
    python_env.yaml
    requirements.txt

Kho Git trên Github

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

Tệp MLproject

  • name: - Tên Project

  • entry_points:

    • Lệnh chạy
    • Tệp .py.sh
    • Quy trình làm việc
  • python_env:

    • Môi trường Python
    • python_env.yaml

YAML

1 wikipedia.org
Giới thiệu về MLflow

Ví dụ MLproject

name: salary_model

entry_points: main: command: "python train_model.py"
python_env: python_env.yaml
Giới thiệu về MLflow

train_model.py

# Import libraries and modules
import mlflow
import mlflow.sklearn
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split

# Training Data df = pd.read_csv('Salary_predict.csv') X = df[["experience", "age", "interview_score"]] y = df[["Salary"]] X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.7,random_state=0)
Giới thiệu về MLflow

train_model.py

# Set Auto logging for Scikit-learn flavor
mlflow.sklearn.autolog()

# Train the model lr = LinearRegression() lr.fit(X_train, y_train)
Giới thiệu về MLflow

python_env.yaml

python: 3.10.8

build_dependencies: - pip - setuptools - wheel
dependencies: - -r requirements.txt
Giới thiệu về MLflow

requirements.txt

mlflow
scikit-learn
Giới thiệu về MLflow

Ayo berlatih!

Giới thiệu về MLflow

Preparing Video For Download...