A platform for the Complete Machine Learning Lifecycle

  • Slides: 28
Download presentation
A platform for the Complete Machine Learning Lifecycle Corey Zumar March 27 th, 2019

A platform for the Complete Machine Learning Lifecycle Corey Zumar March 27 th, 2019

Outline • Overview of ML development challenges • How MLflow tackles these challenges •

Outline • Overview of ML development challenges • How MLflow tackles these challenges • MLflow components • Demo • How to get started 2

Machine Learning Development is Complex 3

Machine Learning Development is Complex 3

μ λθ ML Lifecycle Data Prep Raw Data Delta Model Exchang e Tunin g

μ λθ ML Lifecycle Data Prep Raw Data Delta Model Exchang e Tunin g Scal e Training Scal e μ λθ Tunin g Scal e Deploy Governanc e Scal e 4

Custom ML Platforms Facebook FBLearner, Uber Michelangelo, Google TFX + Standardize the data prep

Custom ML Platforms 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 Can we provide similar benefits in an open manner? 5

Introducing Open machine learning platform • Works with any ML library & language •

Introducing Open machine learning platform • Works with any ML library & language • Runs the same way anywhere (e. g. any cloud) • Designed to be useful for 1000+ person orgs 6

MLflow Components Tracking Projects Record and query experiments: code, configs, results, …etc Packaging format

MLflow Components Tracking Projects Record and query experiments: code, configs, results, …etc Packaging format for reproducible runs on any platform Model s General model format that supports diverse deployment tools 7

Key Concepts in Tracking Parameters: key-value inputs to your code Metrics: numeric values (can

Key Concepts in Tracking Parameters: key-value inputs to your code Metrics: numeric values (can update over time) Artifacts: arbitrary files, including data and models Source: training code that ran Version: version of the training code Tags and Notes: any additional information 8

MLflow Tracking APIs (REST, Python, Java, R) UI Tracking Server API 9

MLflow Tracking APIs (REST, Python, Java, R) UI Tracking Server API 9

MLflow Tracking import mlflow Tracking Record and query experiments: code, configs, results, …etc with

MLflow Tracking import mlflow Tracking Record and query experiments: code, configs, results, …etc 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) 10

MLflow backend stores 1. Entity Store • File. Store (local filesystem) • SQLStore (via

MLflow backend stores 1. Entity Store • File. Store (local filesystem) • SQLStore (via SQLAlchemy) • REST Store 2. Artifact Repository • S 3 backed store • Azure Blob storage • Google Cloud storage • DBFS artifact repo 11

Demo Goal: Classify hand-drawn digits 1. Instrument Keras training code with MLflow tracking APIs

Demo 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

MLflow Projects Motivation Diverse set of training tools Diverse set of environments Result: ML

MLflow Projects Motivation Diverse set of training tools Diverse set of environments Result: ML code is difficult to productionize. 13

MLflow Projects Local Execution Project Spec Code Config Remote Execution Dependencie s Data 14

MLflow Projects Local Execution Project Spec Code Config Remote Execution Dependencie s Data 14

MLflow Projects Packaging format for reproducible ML runs • • Any code folder or

MLflow Projects Packaging format for reproducible ML runs • • Any code folder or Git. Hub repository Optional MLproject file with project configuration Defines dependencies for reproducibility • • Conda (+ R, Docker, …) dependencies can be specified in MLproject Reproducible in (almost) any environment Execution API for running projects • CLI / Python / R / Java • Supports local and remote execution 15

Example MLflow Project my_project/ ├── MLproject │ │ │ ├── conda. yaml ├── main.

Example MLflow Project 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> 16

Demo Goal: Classify hand-drawn digits 1. Instrument Keras training code with MLflow tracking APIs

Demo 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 17

MLflow Models Motivation Inference Code Batch & Stream Scoring ML Frameworks Serving Tools 18

MLflow Models Motivation Inference Code Batch & Stream Scoring ML Frameworks Serving Tools 18

MLflow Models Inference Code Model Format Flavor 1 Flavor 2 Batch & Stream Scoring

MLflow Models Inference Code Model Format Flavor 1 Flavor 2 Batch & Stream Scoring ML Frameworks Standard for ML models Serving Tools 19

MLflow Models Packaging format for ML Models • Any directory with MLmodel file Defines

MLflow Models Packaging format for ML Models • Any directory with MLmodel file Defines dependencies for reproducibility • Conda environment can be specified in MLmodel configuration Model creation utilities • Save models from any framework in MLflow format Deployment APIs • CLI / Python / R / Java 20

Example MLflow Model run_id: 769915006 efd 4 c 4 bbd 662461 my_model/ time_created: 2018

Example MLflow Model run_id: 769915006 efd 4 c 4 bbd 662461 my_model/ time_created: 2018 -06 -28 T 12: 34 ├── MLmodel flavors: │ tensorflow: Usable with Tensorflow │ saved_model_dir: estimator tools / APIs signature_def_key: predict │ python_function: │ Usable with any Python loader_module: │ tool mlflow. tensorflow └ estimator/ ├─ saved_model. pb └─ variables/ mlflow. tensorflow. log_model(. . . ). . . 21

Model Flavors Example Py. Torch mlflow. pytorch. log_model() Train a model Flavor 1: Pyfunc

Model Flavors Example Py. Torch mlflow. pytorch. log_model() Train a model Flavor 1: Pyfunc Model Format Flavor 2: Py. Torch predict = mlflow. pyfunc. load_pyfunc(…) predict(input_dataframe) model = mlflow. pytorch. load_model(…) with torch. no_grad(): model(input_tensor) 22

Model Flavors Example predict = mlflow. pyfunc. load_pyfunc(…) predict(input_dataframe) 23

Model Flavors Example predict = mlflow. pyfunc. load_pyfunc(…) predict(input_dataframe) 23

Demo Goal: Classify hand-drawn digits 1. Instrument Keras training code with MLflow tracking APIs

Demo 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 24

Get started with MLflow pip install mlflow to get started Find docs & examples

Get started with MLflow pip install mlflow to get started Find docs & examples at mlflow. org tinyurl. com/mlflow-slack 2525

0. 9. 0 Release MLflow 0. 9. 0 was released this week! Major features:

0. 9. 0 Release MLflow 0. 9. 0 was released this week! Major features: • Tracking server supports SQL via SQLAlchemy • Pluggable tracking server backends • Docker environments for Projects • Custom python models 2626

Ongoing MLflow Roadmap • UI scalability improvements (1. 0) • X-coordinate logging for metrics

Ongoing MLflow Roadmap • UI scalability improvements (1. 0) • X-coordinate logging for metrics & batched logging (1. 0) • Fluent API for Java and Scala (1. 0) • Packaging projects with build steps (1. 0+) • Better environment isolation when loading models (1. 0) • Improved model schemas (1. 0) 27

Thank you! 28

Thank you! 28