A platform for the Complete Machine Learning Lifecycle
Corey Zumar
June 24th, 2019
A platform for the Complete Machine Learning Lifecycle Corey Zumar - - PowerPoint PPT Presentation
A platform for the Complete Machine Learning Lifecycle Corey Zumar June 24 th , 2019 Outline Overview of ML development challenges How MLflow tackles these challenges MLflow components Demo How to get started 2 Machine
Corey Zumar
June 24th, 2019
2
3
4
Data Prep Training Deploy Raw Data
μ λ θ Tuning
Scale
μ λ θ Tuning
Scale Scale Scale Model Exchange Governance
Delta
5
Facebook FBLearner, Uber Michelangelo, Google TFX
+Standardize the data prep / training / deploy loop:
if you work with the platform, you get these!
–Limited to a few algorithms or frameworks –Tied to one company’s infrastructure
6
Open machine learning platform
7
Record and query experiments: code, configs, results, …etc
Packaging format for reproducible runs
General model format that supports diverse deployment tools
8
Parameters: key-value inputs to your code Metrics: numeric values (can update over time) Source: training code that ran Version: version of the training code Artifacts: files, including data and models Tags and Notes: any additional information
9
Tracking Server
UI API Tracking APIs (REST, Python, Java, R)
10
Record and query experiments: code, configs, results, …etc
import mlflow with mlflow.start_run(): mlflow.log_param("layers", layers) mlflow.log_param("alpha", alpha) # train model mlflow.log_metric("mse", model.mse()) mlflow.log_artifact("plot", model.plot(test_df)) mlflow.tensorflow.log_model(model)
11
Goal: Classify hand-drawn digits
1.
Instrument Keras training code with MLflow tracking APIs
2.
Run training code as an MLflow Project
3.
Deploy an MLflow Model for real-time serving
12
13
Record and query experiments: code, configs, results, …etc
Packaging format for reproducible runs
General model format that supports diverse deployment tools
14
15
Project Spec
Code Data Config
Local Execution Remote Execution
Dependencies
16
Packaging format for reproducible ML runs
Defines dependencies for reproducibility
Execution API for running projects
17
my_project/ ├── MLproject │ │ │ │ │ ├── conda.yaml ├── main.py └── model.py ...
conda_env: conda.yaml entry_points: main: parameters: training_data: path lambda: {type: float, default: 0.1} command: python main.py {training_data} {lambda}
$ mlflow run git://<my_project>
18
Goal: Classify hand-drawn digits
1.
Instrument Keras training code with MLflow tracking APIs
2.
Run training code as an MLflow Project
3.
Deploy an MLflow Model for real-time serving
19
Record and query experiments: code, configs, results, …etc
Packaging format for reproducible runs
General model format that supports diverse deployment tools
20
Inference Code Batch & Stream Scoring Serving Tools
ML Frameworks
21
Model Format
Flavor 2 Flavor 1
ML Frameworks
Inference Code Batch & Stream Scoring Serving Tools Standard for ML models
22
Packaging format for ML Models
Defines dependencies for reproducibility
Model creation utilities
Deployment APIs
23
my_model/ ├── MLmodel │ │ │ │ │ └ estimator/ ├─ saved_model.pb └─ variables/ ... Usable with Tensorflow tools / APIs Usable with any Python tool
run_id: 769915006efd4c4bbd662461 time_created: 2018-06-28T12:34 flavors: flavors: tensorflow tensorflow: saved_model_dir: estimator signature_def_key: predict python_function python_function: loader_module: mlflow.tensorflow
mlflow mlflow.tensorflow.log_model .tensorflow.log_model(...) (...)
24
Train a model
mlflow.keras.log_model() Model Format
Flavor 1: Pyfunc Flavor 2: Keras
predict = mlflow.pyfunc.load_pyfunc(…) predict(input_dataframe) model = mlflow.keras.load_model(…) model.predict(keras.Input(…))
25
predict = mlflow.pyfunc.load_pyfunc(…) predict(input_dataframe)
26
Goal: Classify hand-drawn digits
1.
Instrument Keras training code with MLflow tracking APIs
2.
Run training code as an MLflow Project
3.
Deploy an MLflow Model for real-time serving
27
27
28
29
29
30