A platform for the Complete Machine Learning Lifecycle Corey Zumar - - PowerPoint PPT Presentation

a platform for the complete machine learning lifecycle
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

A platform for the Complete Machine Learning Lifecycle

Corey Zumar

June 24th, 2019

slide-2
SLIDE 2

2

Outline

  • Overview of ML development challenges
  • How MLflow tackles these challenges
  • MLflow components
  • Demo
  • How to get started
slide-3
SLIDE 3

3

Machine Learning Development is Complex

slide-4
SLIDE 4

4

ML Lifecycle

Data Prep Training Deploy Raw Data

μ λ θ Tuning

Scale

μ λ θ Tuning

Scale Scale Scale Model Exchange Governance

Delta

slide-5
SLIDE 5

5

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?

slide-6
SLIDE 6

6

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 1 or 1000+ person orgs
slide-7
SLIDE 7

7

MLflow Components

Tracking

Record and query experiments: code, configs, results, …etc

Projects

Packaging format for reproducible runs

  • n any platform

Models

General model format that supports diverse deployment tools

slide-8
SLIDE 8

8

Key Concepts in Tracking

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

slide-9
SLIDE 9

9

MLflow Tracking

Tracking Server

UI API Tracking APIs (REST, Python, Java, R)

slide-10
SLIDE 10

10

MLflow Tracking

Tracking

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)

slide-11
SLIDE 11

11

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

slide-12
SLIDE 12

12

MLflow backend stores

  • 1. Entity (Metadata) Store
  • FileStore (local filesystem)
  • SQLStore (via SQLAlchemy)
  • REST Store
  • 2. Artifact Store
  • S3 backed store
  • Azure Blob storage
  • Google Cloud storage
  • DBFS artifact repo
slide-13
SLIDE 13

13

MLflow Components

Tracking

Record and query experiments: code, configs, results, …etc

Projects

Packaging format for reproducible runs

  • n any platform

Models

General model format that supports diverse deployment tools

slide-14
SLIDE 14

14

MLflow Projects Motivation

Diverse set of training tools Diverse set of environments Challenge: ML results are difficult to reproduce.

slide-15
SLIDE 15

15

Project Spec

Code Data Config

Local Execution Remote Execution

MLflow Projects

Dependencies

slide-16
SLIDE 16

16

MLflow Projects

Packaging format for reproducible ML runs

  • Any code folder or GitHub 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
slide-17
SLIDE 17

17

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>

slide-18
SLIDE 18

18

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

slide-19
SLIDE 19

19

MLflow Components

Tracking

Record and query experiments: code, configs, results, …etc

Projects

Packaging format for reproducible runs

  • n any platform

Models

General model format that supports diverse deployment tools

slide-20
SLIDE 20

20

Inference Code Batch & Stream Scoring Serving Tools

Mlflow Models Motivation

ML Frameworks

slide-21
SLIDE 21

21

Model Format

Flavor 2 Flavor 1

ML Frameworks

Inference Code Batch & Stream Scoring Serving Tools Standard for ML models

MLflow Models

slide-22
SLIDE 22

22

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
slide-23
SLIDE 23

23

Example MLflow Model

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(...) (...)

slide-24
SLIDE 24

24

Model Flavors Example

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(…))

slide-25
SLIDE 25

25

Model Flavors Example

predict = mlflow.pyfunc.load_pyfunc(…) predict(input_dataframe)

slide-26
SLIDE 26

26

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

slide-27
SLIDE 27

27

1.0 Release

MLflow 1.0 was released recently! Major features:

  • New metrics UI
  • “Step” axis for metrics
  • Improved search capabilities
  • Package MLflow Models as Docker containers
  • Support for ONNX models

27

slide-28
SLIDE 28

28

Ongoing MLflow Roadmap

  • New component: Model Registry for model management
  • Multi-step project workflows
  • Fluent Tracking API for Java and Scala
  • Packaging projects with build steps
  • Better environment isolation when loading models
  • Improved model input/output schemas
slide-29
SLIDE 29

29

Get started with MLflow

pip install mlflow to get started

Find docs & examples at mlflow.org tinyurl.com/mlflow-slack

29

slide-30
SLIDE 30

30

Thank you!