47
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Makoto Shimura Analytics Specialist SA, Amazon Web Services Japan 2-H1-3-16 ML Ops on AWS

ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Makoto Shimura

Analytics Specialist SA, Amazon Web Services Japan

2-H1-3-16

ML Ops on AWS

Page 2: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

About Me

(Makoto Shimura)

• データ分析・機械学習系サービスを担当

• 前職はログ解析基盤構築・データ分析等

• 好きなサービス• Amazon Athena

• AWS Glue

• Amazon SageMaker

Page 3: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Key Take Away

ML

AWS

Page 4: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Agenda

• ML

• ML

• ML

Page 5: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

Page 6: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ビジネス課題

データ収集

データの加工整形

ML

データの分析・可視化

アプリケーションシステム

Page 7: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

1.

2. ML

3. ML

Page 8: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

1.

まずは自分たちのビジネスを振り返って,ニーズがあるが実現できていない部分に注目

ML から出発するのではなく,あくまで課題を解決するためのツールと考える

もっと簡単にできないかを考えて,他にないときにはじめて ML を選択する

Page 9: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

2. ML

ML

Page 10: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

3. ML

Page 11: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ビジネス課題

データ収集

データの加工整形

ML

データの分析・可視化

アプリケーションシステム

Page 12: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ビジネス課題

ML

アプリケーションシステム

Kinesis S3

EMR Glue

Redshift Athena QuickSight

Page 13: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ビジネス課題

ML

アプリケーションシステム

Kinesis S3

EMR Glue

Redshift Athena QuickSight

いかに早く安定してループを回せるかデータレイクと環境整備が必須

でないと予測結果が正しいかすら不明

Page 14: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

Page 15: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ビジネス課題

データ収集

データの加工整形

ML

データの分析・可視化

アプリケーションシステム

Page 16: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

開発

学習推論

Page 17: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

• ML

Page 18: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 19: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

•AB

Page 20: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

開発

学習推論

Page 21: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 22: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

• 開発環境は最新版の Tensorflow だが,本番環境は 1.4 のまま

• 本番環境の依存ライブラリを把握できていない

• データサイエンティストが R で書いたコードを,エンジニアが本番環境用に Java で再実装

• 本番環境はエンジニアの管轄で,毎度お願いしないといけない

• ML モデルがアプリケーションのコード内に組み込まれており,統合テストを経ないとデプロイできない

Page 23: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML cont.

• 複数サービスのモデルを同一 API サーバ上にホストしている

• 自分の新しいモデルを動かすために CUDA バージョンを上げたことで,他サービスのモデルがエラーを吐くように

• 同じデータで同じモデルを学習させたはずなのに違う結果が…

• 学習時に前処理を間違えて,全然ダメなモデルを学習していた

• 収益に直接影響する場合,ビジネス側と連携してデプロイ/ 切り戻しをおこなわないといけない

Page 24: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

DevOps

• Infrastructure as Code:

immutable

• Microservices:

• Continuous Delivery:

Page 25: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

DevOps ML

• Infrastructure as Code: ML

• Microservices: ML

• Continuous Delivery:

Page 26: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

DevOps ML Ops

• AB

Page 27: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML Ops

• Infrastructure as Code: ML

DWH

• micsoservices: ML ML

• Continuous Delivery: AB

Page 28: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML Ops

• Infrastructure as Code: • 開発環境と本番環境でライブラリが違う問題

• 一度学習したモデルを再現できない問題

• micsoservices: • 開発環境と本番環境で実行環境自体がまるで違う問題

• 新しいモデルを作ってもすぐにデプロイできない問題

• あるサービスのモデルのデプロイが他サービスに影響する問題

• Continuous Delivery: • 新しいモデルをデプロイしたら悲惨な予測を返すことがある問題

Page 29: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML Ops AWS

Infrastructure as Code microservices Continuous Deploy

Amazon

ECR

AWS

CodeBuild

AWS Step

Functions

Amazon

SageMaker

AWS

GreengrassAWS

CodeCommit

Amazon

ECS

Amazon

SageMaker

Page 30: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

開発

学習推論

Page 31: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon SageMaker

ML

開発 学習 推論

SageMaker API を

叩いてジョブを実行

複数ジョブを同時実行

分散学習も簡単に実行

コンソールから起動

主要ライブラリは

プリインストール済

SageMaker API から

エンドポイント作成

オートスケーリング

A/Bテスト

Jupyter Notebook Docker コンテナ Docker コンテナ

Page 32: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

Page 33: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

Page 34: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Kinesis

Firehose

S3

SageMaker

Glue

Athena QuickSight

App

Servers

Page 35: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

EC

Kinesis

FirehoseS3

EMR

Glue

Athena QuickSight

App

ServersDynamoDB

Page 36: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Camera Device

Detection App

GPU

Greengrass Core

Camera

AWS IoT

Glue

Athena QuickSight

S3 SageMaker

Greengrass

Page 37: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

Page 38: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

StepFunctions ML

Start

CodeBuildStartBuild

学習コンテナ

SageMakerCreateTrainingJob

CodeBuildStartBuild

推論コンテナ

SageMakerCreateModel

SageMakerCreateEndpointConfig

SageMakerCreateEndpointUndateEndpoint

wait

wait

wait wait

SNSエラー通知

SNS成功通知

GreengrassCreateDeployment

Page 39: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

StepFunctions

RDS

S3

RedShift

Glue学習用入力データの作成

S3

Glueデータの

スキーマ管理

RDSメタデータを

バージョン含めて管理

SageMaker学習ジョブの実行とモデルのデプロイ

メタデータ管理複数の機械学習タスクで特徴量を使いまわす仕組み

その他のワークフローエンジンを利用することも可能

Page 40: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

Start

SageMakerCreateTrainingJob

CloudWatchLogs学習ジョブのログを取得

Lambdaモデル精度を取得して

DB に書き込み

QuickSightリーダーボード複数モデルの比較

SageMakerCreateTrainingJob

SageMakerCreateTrainingJob...

...

RDS

Page 41: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

S3

RDS

Start

CreateTrainingJob CreateModel

JSON

ID

Dockerfile

CodeCommit

S3

SageMaker

ECR

DVCGit LFS

Page 42: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

AB

モデル名と予測値を返却

特徴量をリクエスト

モデル名・予測値・結果を収集

Elasticsearch Serviceテスト結果の

リアルタイム可視化

Lambdaテスト結果の集計

SNSエラー通知

域値以下の結果

S3テスト結果の履歴を保存

Athena & QuickSight長期的なトレンドを集計して可視化

SageMaker複数モデルをホストし

常時 AB テスト

AppServers

Kinesis

Page 43: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

/

オンプレ本番環境

ML モデルに関するリソースは,すべて AWS 側で管理S3 を介して AWS とオンプレで連携

オンプレ本番環境

作成済みの ML モデルの,バイナリデータ以降を SageMaker で管理S3 を介してオンプレと AWS で連携

SageMaker S3CodeBuild

SageMakerS3

Direct Connect

Direct Connect

Page 44: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 45: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

ML

AWS

Page 46: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

お手元のサミットガイドブックの表紙に記載している 『QRコード』 からご回答くださいもれなく素敵なAWSオリジナルグッズをプレゼントします

本セッションのFeedbackをお願いします

プレゼントの引き換えは,パミール3F展示会場内アンケート確認エリア・受付エリアのいずれかにお越しください

Page 47: ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take Away ML AWS

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.