ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take...
Transcript of ML Ops on AWS© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Take...
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
About Me
(Makoto Shimura)
•
• データ分析・機械学習系サービスを担当
• 前職はログ解析基盤構築・データ分析等
• 好きなサービス• Amazon Athena
• AWS Glue
• Amazon SageMaker
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ビジネス課題
データ収集
データの加工整形
ML
データの分析・可視化
アプリケーションシステム
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
1.
2. ML
3. ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
1.
まずは自分たちのビジネスを振り返って,ニーズがあるが実現できていない部分に注目
ML から出発するのではなく,あくまで課題を解決するためのツールと考える
もっと簡単にできないかを考えて,他にないときにはじめて ML を選択する
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2. ML
ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
3. ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ビジネス課題
データ収集
データの加工整形
ML
データの分析・可視化
アプリケーションシステム
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ビジネス課題
ML
アプリケーションシステム
Kinesis S3
EMR Glue
Redshift Athena QuickSight
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ビジネス課題
ML
アプリケーションシステム
Kinesis S3
EMR Glue
Redshift Athena QuickSight
いかに早く安定してループを回せるかデータレイクと環境整備が必須
でないと予測結果が正しいかすら不明
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ビジネス課題
データ収集
データの加工整形
ML
データの分析・可視化
アプリケーションシステム
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
開発
学習推論
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• ML
•
•
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
•
•
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•AB
•
•
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
開発
学習推論
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
•
• 開発環境は最新版の Tensorflow だが,本番環境は 1.4 のまま
• 本番環境の依存ライブラリを把握できていない
•
• データサイエンティストが R で書いたコードを,エンジニアが本番環境用に Java で再実装
•
• 本番環境はエンジニアの管轄で,毎度お願いしないといけない
• ML モデルがアプリケーションのコード内に組み込まれており,統合テストを経ないとデプロイできない
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML cont.
•
• 複数サービスのモデルを同一 API サーバ上にホストしている
• 自分の新しいモデルを動かすために CUDA バージョンを上げたことで,他サービスのモデルがエラーを吐くように
•
• 同じデータで同じモデルを学習させたはずなのに違う結果が…
•
• 学習時に前処理を間違えて,全然ダメなモデルを学習していた
• 収益に直接影響する場合,ビジネス側と連携してデプロイ/ 切り戻しをおこなわないといけない
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps
• Infrastructure as Code:
immutable
• Microservices:
• Continuous Delivery:
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps ML
• Infrastructure as Code: ML
• Microservices: ML
• Continuous Delivery:
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps ML Ops
•
•
•
• AB
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML Ops
• Infrastructure as Code: ML
DWH
• micsoservices: ML ML
• Continuous Delivery: AB
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML Ops
• Infrastructure as Code: • 開発環境と本番環境でライブラリが違う問題
• 一度学習したモデルを再現できない問題
• micsoservices: • 開発環境と本番環境で実行環境自体がまるで違う問題
• 新しいモデルを作ってもすぐにデプロイできない問題
• あるサービスのモデルのデプロイが他サービスに影響する問題
• Continuous Delivery: • 新しいモデルをデプロイしたら悲惨な予測を返すことがある問題
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
開発
学習推論
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SageMaker
ML
開発 学習 推論
SageMaker API を
叩いてジョブを実行
複数ジョブを同時実行
分散学習も簡単に実行
コンソールから起動
主要ライブラリは
プリインストール済
SageMaker API から
エンドポイント作成
オートスケーリング
A/Bテスト
Jupyter Notebook Docker コンテナ Docker コンテナ
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kinesis
Firehose
S3
SageMaker
Glue
Athena QuickSight
App
Servers
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC
Kinesis
FirehoseS3
EMR
Glue
Athena QuickSight
App
ServersDynamoDB
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
StepFunctions
RDS
S3
RedShift
Glue学習用入力データの作成
S3
Glueデータの
スキーマ管理
RDSメタデータを
バージョン含めて管理
SageMaker学習ジョブの実行とモデルのデプロイ
メタデータ管理複数の機械学習タスクで特徴量を使いまわす仕組み
その他のワークフローエンジンを利用することも可能
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
Start
SageMakerCreateTrainingJob
CloudWatchLogs学習ジョブのログを取得
Lambdaモデル精度を取得して
DB に書き込み
QuickSightリーダーボード複数モデルの比較
SageMakerCreateTrainingJob
SageMakerCreateTrainingJob...
...
RDS
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AB
モデル名と予測値を返却
特徴量をリクエスト
モデル名・予測値・結果を収集
Elasticsearch Serviceテスト結果の
リアルタイム可視化
Lambdaテスト結果の集計
SNSエラー通知
域値以下の結果
S3テスト結果の履歴を保存
Athena & QuickSight長期的なトレンドを集計して可視化
SageMaker複数モデルをホストし
常時 AB テスト
AppServers
Kinesis
© 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
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ML
AWS
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
お手元のサミットガイドブックの表紙に記載している 『QRコード』 からご回答くださいもれなく素敵なAWSオリジナルグッズをプレゼントします
本セッションのFeedbackをお願いします
プレゼントの引き換えは,パミール3F展示会場内アンケート確認エリア・受付エリアのいずれかにお越しください
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.