Slide 1

Slide 1 text

© 2019, Amazon Web Services, Inc. or its Affiliates. アマゾン ウェブ サービス ジャパン株式会社 Solutions Architect 針原 佳貴 2020-03-26 Amazon SageMaker Build, train, and deploy machine learning models #SageMaker

Slide 2

Slide 2 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 自己紹介 • 針原 佳貴 (はりばら よしたか) • 博士 (情報理工学) • Startup Solutions Architect • スタートアップの技術支援・機械学習導入支援 • 好きなサービスは Amazon SageMaker

Slide 3

Slide 3 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. 全てのデベロッパーの手に 機械学習を Our mission at AWS

Slide 4

Slide 4 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Customer-focused 90%以上の ML ロードマップは お客様の声によるもの Multi-framework 主要なフレームワークの サポート Pace of innovation 去年200以上の ML 関連の 発表・主要な機能追加 Breadth and depth 幅広い AI/ML サービスを プロダクション導入 Security and analytics 豊富なセキュリティ・暗号化 に関する機能と頑強な分析基盤 Embedded R&D 顧客中心のアプローチで state-of-the-art を実現 AWS の機械学習に対するアプローチ

Slide 5

Slide 5 text

AWS 上で機械学習ワークロードを実行中のお客様 (一部)

Slide 6

Slide 6 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS の機械学習スタック 幅広く完全な機械学習のサービス群 コンピュータ ビジョン 音声 テキスト 検索 NEW チャットボット パーソナライズ 予測 不正検知 NEW 開発 NEW コンタクトセンターNEW Amazon SageMaker Ground Truth Augmented AI SageMaker Neo Built-in algorithms SageMaker Notebooks NEW SageMaker Experiments NEW Model tuning SageMaker Debugger NEW SageMaker Autopilot NEW Model hosting SageMaker Model Monitor NEW Deep Learning AMIs & Containers GPUs & CPUs Elastic Inference Inferentia FPGA Amazon Rekognition Amazon Polly Amazon Transcribe +Medical Amazon Comprehend +Medical Amazon Translate Amazon Lex Amazon Personalize Amazon Forecast Amazon Fraud Detector Amazon CodeGuru AI サービス ML サービス 深層学習フレームワーク & インフラ Amazon Textract Amazon Kendra Contact Lens For Amazon Connect SageMaker Studio IDE NEW NEW

Slide 7

Slide 7 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker

Slide 8

Slide 8 text

© 2019, Amazon Web Services, Inc. or its Affiliates. あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ Amazon SageMaker

Slide 9

Slide 9 text

© 2019, Amazon Web Services, Inc. or its Affiliates. あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ Amazon SageMaker トレーニングと パラメーター チューニング トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 本番環境での 運用とスケーリング

Slide 10

Slide 10 text

© 2019, Amazon Web Services, Inc. or its Affiliates. あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 本番環境での 運用とスケーリング Amazon SageMaker Ground Truth トレーニングと パラメーター チューニング Amazon SageMaker

Slide 11

Slide 11 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 本番環境での 運用とスケーリング あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 Amazon SageMaker Ground Truth AWS Marketplace for Machine Learning トレーニングと パラメーター チューニング • k-means クラスタリング • Factorization Machines (レコメンド) • DeepAR (時系列予測) • BlazingText (Word2Vec) • Object2Vec • XGBoost • 画像分類・物体検出 • Seq2Seq • LDA / Neural Topic Modelling (トピックモデル) • 主成分分析 • 線型学習器 (回帰 / 分類) など Amazon SageMaker

Slide 12

Slide 12 text

© 2019, Amazon Web Services, Inc. or its Affiliates. あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 本番環境での 運用とスケーリング Amazon EC2 P3 Instances Managed Spot Training Amazon SageMaker Ground Truth AWS Marketplace for Machine Learning トレーニングと パラメーター チューニング Amazon SageMaker

Slide 13

Slide 13 text

© 2019, Amazon Web Services, Inc. or its Affiliates. トレーニングと パラメーター チューニング あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 本番環境での 運用とスケーリング Amazon EC2 P3 Instances Managed Spot Training Amazon SageMaker Ground Truth AWS Marketplace for Machine Learning Amazon SageMaker

Slide 14

Slide 14 text

© 2019, Amazon Web Services, Inc. or its Affiliates. トレーニングと パラメーター チューニング あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 本番環境での 運用とスケーリング Amazon EC2 P3 Instances Managed Spot Training Amazon SageMaker Ground Truth AWS Marketplace for Machine Learning Amazon SageMaker Neo Amazon SageMaker

Slide 15

Slide 15 text

© 2019, Amazon Web Services, Inc. or its Affiliates. トレーニングと パラメーター チューニング あらゆる規模で機械学習・深層学習モデルを構築・トレーニング・デプロイ トレーニング 環境の 整備と運用 本番環境への デプロイ 学習データの 収集と準備 ML アルゴリズム の 選択と最適化 1 2 3 本番環境での 運用とスケーリング Amazon EC2 P3 Instances Managed Spot Training Amazon SageMaker Ground Truth Amazon Elastic Inference Multi-Model Endpoint AWS Marketplace for Machine Learning Amazon SageMaker Neo Amazon SageMaker

Slide 16

Slide 16 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker の使い方

Slide 17

Slide 17 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 開発環境として Jupyter Notebook/Lab を簡単に使える • インスタンスタイプを選んで立ち上げるだけ • フレームワークがプリインストール • ノートブックインスタンス作成・起動時にスクリプト実行 • https://github.com/aws-samples/amazon-sagemaker-notebook-instance-lifecycle-config-samples

Slide 18

Slide 18 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Jupyter Notebook/Lab Amazon S3 The Jupyter Trademark is registered with the U.S. Patent & Trademark Office. 開発 データは予め Amazon S3 にアップロード: • SageMaker Python SDK で簡単に • sagemaker_session.upload_data( path='data', key_prefix='data/DEMO') • AWS CLI や AWS SDK (Python だと boto3) などでも • aws s3 sync • GUI (マネージメントコンソール) からでも

Slide 19

Slide 19 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker 開発 Jupyter Notebook/Lab Amazon S3 The Jupyter Trademark is registered with the U.S. Patent & Trademark Office.

Slide 20

Slide 20 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker 開発 Jupyter Notebook/Lab Amazon S3 学習 Amazon EC2 P3 Instances Amazon ECR The Jupyter Trademark is registered with the U.S. Patent & Trademark Office. ビルド済みのコンテナイメージが 予め用意されている

Slide 21

Slide 21 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker 開発 学習 Amazon EC2 P3 Instances Jupyter Notebook/Lab Amazon S3 The Jupyter Trademark is registered with the U.S. Patent & Trademark Office. トレーニングでのメリット: • API 経由で学習用インスタ ンスを起動、 学習が完了すると自動停止 • 高性能なインスタンスを 秒課金で、 簡単にコスト削減 • 指定した数のインスタンス を同時起動、 分散学習も容易

Slide 22

Slide 22 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker 開発 学習 Amazon EC2 P3 Instances Jupyter Notebook/Lab Amazon S3 The Jupyter Trademark is registered with the U.S. Patent & Trademark Office.

Slide 23

Slide 23 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker 開発 学習 推論 Amazon EC2 P3 Instances Jupyter Notebook/Lab Endpoint/ Batch transform Amazon S3 Amazon ECR The Jupyter Trademark is registered with the U.S. Patent & Trademark Office.

Slide 24

Slide 24 text

© 2019, Amazon Web Services, Inc. or its Affiliates. ワークフロー構築を助けるツール • SageMaker Python SDK • https://github.com/aws/sagemaker-python-sdk/ • AWS Step Functions Data Science SDK • https://github.com/aws/aws-step-functions-data-science-sdk-python • Docker コンテナによる環境統一 • ビルド済みコンテナ (対応フレームワークのバージョン) は上記 URL の README • Git レポジトリとの統合

Slide 25

Slide 25 text

© 2019, Amazon Web Services, Inc. or its Affiliates. SageMaker Python SDK import sagemaker

Slide 26

Slide 26 text

© 2019, Amazon Web Services, Inc. or its Affiliates. SageMaker Python SDK import sagemaker from sagemaker.mxnet import MXNet # 各フレームワークに対応した Estimator クラス estimator = MXNet("train.py", # トレーニングスクリプトなどを指定して初期化 role=sagemaker.get_execution_role(), train_instance_count=1, train_instance_type="ml.p3.2xlarge", framework_version="1.4.1")

Slide 27

Slide 27 text

© 2019, Amazon Web Services, Inc. or its Affiliates. SageMaker Python SDK import sagemaker from sagemaker.mxnet import MXNet # 各フレームワークに対応した Estimator クラス estimator = MXNet("train.py", # トレーニングスクリプトなどを指定して初期化 role=sagemaker.get_execution_role(), train_instance_count=1, train_instance_type="ml.p3.2xlarge", framework_version="1.4.1") estimator.fit("s3://mybucket/data/train") # fit でトレーニング

Slide 28

Slide 28 text

© 2019, Amazon Web Services, Inc. or its Affiliates. SageMaker Python SDK import sagemaker from sagemaker.mxnet import MXNet # 各フレームワークに対応した Estimator クラス estimator = MXNet("train.py", # トレーニングスクリプトなどを指定して初期化 role=sagemaker.get_execution_role(), train_instance_count=1, train_instance_type="ml.p3.2xlarge", framework_version="1.4.1") estimator.fit("s3://mybucket/data/train") # fit でトレーニング predictor = estimator.deploy(initial_instance_count=2, # 2以上にすると Multi-AZ instance_type="ml.m5.xlarge") # deploy でエンドポイント作成

Slide 29

Slide 29 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 「コンテナ」による環境の統⼀化 CUDA, cuDNN トレーニングスクリプト train.py Deep Learning Framework スクリプトの実行に必要なものを コードで記述し一箇所にまとめる Docker image

Slide 30

Slide 30 text

© 2019, Amazon Web Services, Inc. or its Affiliates. コードの書き換え (Script Mode, File Mode) import argparse if __name__ == '__main__’: parser = argparse.ArgumentParser() # hyperparameters parser.add_argument('--epochs', type=int, default=10) # input data and model directories parser.add_argument('--train', type=str, default=os.environ['SM_CHANNEL_TRAIN']) parser.add_argument('--test', type=str, default=os.environ['SM_CHANNEL_TEST']) parser.add_argument('--model-dir', type=str, default=os.environ['SM_MODEL_DIR']) args, _ = parser.parse_known_args() … (以下省略) train.py コンテナ内のパス (環境変数の中身): /opt/ml/input/data/train /opt/ml/input/data/test /opt/ml/model 環境変数 から取得 Script Mode では普通の Python スクリプトとして実行される。 はじめに環境変数からデータ・モデル入出力のパスを取得して、 そこを読み書きするように train.py を書く。推論用にモデルを読み込む。

Slide 31

Slide 31 text

© 2019, Amazon Web Services, Inc. or its Affiliates. データ入力 • Amazon S3 • FILE モード (Default): データをダウンロードしてから学習開始 • S3 からデータダウンロード • トレーニング開始 • PIPE モード: ストリーミングでダウンロードしながら非同期に学習を実施 • Epoch ごとに channel を作ってストリーミングでデータを読むことによって ファイル転送のオーバーヘッドを軽減 • TensorFlow, MXNet のみ対応 • ブログ「Amazon SageMaker でより速いパイプモードを使用してモデルの トレーニングを高速化する」 • Amazon EFS • Amazon FSx for Lustre

Slide 32

Slide 32 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Git レポジトリとの統合 • Notebook インスタンス立ち上げ時に紐付けが可能 • Public レポジトリの clone • Private レポジトリの認証情報を AWS Secrets Manager に保管して レポジトリを登録 • Git レポジトリのコードから直接トレーニングを実行する事も可能 • ブログ「Amazon SageMaker Python SDK で Git 統合を利用可能」 git_config = {'repo': 'https://github.com/awslabs/amazon-sagemaker-examples.git’, 'branch': 'training-scripts’} estimator = TensorFlow(entry_point='train.py', source_dir='char-rnn-tensorflow', git_config=git_config, train_instance_type=train_instance_type, train_instance_count=1, role=sagemaker.get_execution_role(), framework_version=‘1.14', py_version='py3', script_mode=True) • Jupyter Lab で Notebook の diff を取れる • SageMaker Notebooks now support diffing

Slide 33

Slide 33 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. 継続的な機械学習のワークフロー

Slide 34

Slide 34 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 機械学習の一般的なワークフロー データ収集 クリーン アップ データ変換・ ラベル付け トレーニング モデル評価 本番環境に デプロイ 推論・監視

Slide 35

Slide 35 text

© 2019, Amazon Web Services, Inc. or its Affiliates. トレーニングジョブとモデルの管理 • トレーニングジョブには 以下のような情報が記録される • ジョブ名 • 作成時間 • トレーニング時間 • インスタンスタイプ・数 • コンテナイメージ (レポジトリ URI) • 入力データ • チャネル名・型・S3 URI など • 出力 • 学習済みモデルとそのS3 パス • ハイパーパラメータ • メトリクス • ジョブを検索可能 • アルゴリズム名 • イメージ • データ URI • 開始・終了時間 メトリクスでソート、 ベストなモデルを取得し、 その時の実験環境を再現 することが可能

Slide 36

Slide 36 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 継続的な機械学習のワークフロー • トレーニングからデプロイまでのワークフローを自動化 • AWS Step Functions, Apache Airflow • 継続的なモデルのアップデートを実現 • スケジュール / イベントトリガーによる増分学習 • とにかく自動化、自動化、自動化しきれないところは半自動化 • Human-in-the-Loop

Slide 37

Slide 37 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Step Functions • JSON ベースの言語でステートマシンを記述できるマネージドサービス • AWS Step Functions Data Science SDK • AWS Lambda をはじめとした各サービスに対応 • CloudWatch Event でスケジュール実行やイベントトリガーが可能 Start End Train Deploy Prepare data AWS Glue Amazon SageMaker Amazon SageMaker Amazon CloudWatch Events (Schedule / event trigger)

Slide 38

Slide 38 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Step Functions workflow 機械学習パイプラインの構築例 Test data Train data Data Scientists/ Developers Git webhook docker push AWS Glue Amazon S3 (data) Amazon SageMaker Training Job / HPO AWS CodeCommit or 3rd party Git repository Amazon S3 (raw data) Amazon Elastic Container Registry (ECR) AWS CodeBuild Endpoint https://aws.amazon.com/blogs/machine-learning/automated-and-continuous-deployment-of-amazon-sagemaker-models-with-aws-step-functions/ Amazon SageMaker Batch Transform / Endpoint deploy Amazon S3 (trained model) git push

Slide 39

Slide 39 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Apache Airflow にも SageMaker Operator が用意されている • Python で記述した DAG (有向非巡回グラフ) でワークフロー管理 • Amazon SageMaker とのインテグレーションも • EC2 + RDS は別途必要 (マネージドサービスではない) Raw data Cleaned data Train data Test data Amazon SageMaker Training / HPO Model artifact Amazon SageMaker Batch transform Airflow DAG Filter long-tailed data sparse data format → RecordIO protobuf Analyze model performance based on test data Operator PythonOperator PythonOperator SageMakerTrainOperator/ SageMakerTransformOperator PythonOperator SageMakerTuningOperator Blog: https://aws.amazon.com/jp/blogs/news/build-end-to-end-machine-learning-workflows-with-amazon-sagemaker-and-apache-airflow/ Prediction results

Slide 40

Slide 40 text

© 2019, Amazon Web Services, Inc. or its Affiliates. データ収集・アノテーションの課題と求められること • 集まったデータで再学習がしたい • 教師データの質は、その後のモデルの質を決定する • 自動化されたワークフローの中でも精度を担保できるよう 時には人手のラベル付けが必要

Slide 41

Slide 41 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Ground Truth

Slide 42

Slide 42 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Ground Truth • アノテーションの一般的なワークフローをサポート • 6種類の組み込みラベリングツールとワーカー連携 • アクティブラーニング・自動ラベリング機能で最大70%のコスト削減 • ラベル統合 (label consolidation) による高精度なラベル付け • AWS StepFunctions からの呼び出しにも対応 迅速・効率的 簡単 高精度

Slide 43

Slide 43 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 6種類の組み込みツール+カスタムジョブと 3種類のワーカー

Slide 44

Slide 44 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 精度の高い 学習用データセット 入力 データセット 人がラベル付けしたデータから アクティブラーニングのモデルを学習 自動 アノテーション 信頼度の低いデータは 人間がアノテーション アクティブラーニングと自動データラベリング アクティブ ラーニング

Slide 45

Slide 45 text

© 2019, Amazon Web Services, Inc. or its Affiliates. ワークフローを構築し、詰まる部分を改善 データ収集 クリーン アップ データ変換・ ラベル付け トレーニング モデル評価 本番環境に デプロイ 推論・監視

Slide 46

Slide 46 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. コストを抑えるための選択肢

Slide 47

Slide 47 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Managed Spot Training

Slide 48

Slide 48 text

© 2019, Amazon Web Services, Inc. or its Affiliates. スポットインスタンスでトレーニングの料金を削減 • オンデマンドに比べて最大90%のコスト削減 • 中断が発生する可能性があるので checkpoints に途中経過を書き出し • 最大で待てる時間を指定 呼び出し方 (SageMaker Python SDK >= v1.37.2 で対応): estimator = Estimator("train.py", role=sagemaker.get_execution_role(), train_instance_count=1, train_instance_type="ml.p3.2xlarge", framework_version="1.4.0", train_use_spot_instances=True, train_max_wait=2*24*60*60, # train_max_run (デフォルト1日) より長い時間を指定 checkpoint_s3_uri="s3://mybucket/checkpoints", checkpoint_local_path="/opt/ml/checkpoints/" ) estimator.fit("s3://mybucket/data/train") # fit でトレーニングは同様

Slide 49

Slide 49 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 推論 (予測) 90% 10% 学習

Slide 50

Slide 50 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 推論における課題

Slide 51

Slide 51 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 推論コストを抑えるための選択肢 1. Batch Transform Job • 必要な時だけエンドポイントを立て大規模データをバッチで推論 2. Amazon Elastic Inference • 推論に必要な分だけ適切な量の計算リソースをアタッチ 3. Multi-Model Endpoint • 一つのエンドポイントの裏に複数モデルをデプロイ 4. Amazon SageMaker Neo • エッジ推論のためモデルのコンパイルによる軽量化と高速化 5. AWS Inferentia • 推論のための ASIC

Slide 52

Slide 52 text

© 2019, Amazon Web Services, Inc. or its Affiliates. エンドポイント立てっぱなしの時

Slide 53

Slide 53 text

© 2019, Amazon Web Services, Inc. or its Affiliates. バッチ変換ジョブを使う時 Amazon S3

Slide 54

Slide 54 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 0 50 100 150 200 1 2 4 6 8 10 セッション数を増やしてもスループットが飽和

Slide 55

Slide 55 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon Elastic Inference コストを 抑えながら 推論 レイテンシを短縮

Slide 56

Slide 56 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Multi-Model Endpoint • 単一のエンドポイントの裏に複数のモデルを置くことができる • 動的にモデルを追加することも可能 S3 model storage tokyo.tar.gz kanagawa.tar.gz osaka.tar.gz aichi.tar.gz S3://bucket/our-endpoint-models/ S3://bucket/our-endpoint-models Load Predict

Slide 57

Slide 57 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Neo

Slide 58

Slide 58 text

© 2019, Amazon Web Services, Inc. or its Affiliates. モデルを最適な形で各デバイスにデプロイしたい

Slide 59

Slide 59 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Neo

Slide 60

Slide 60 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Neo トレーニング済のモデルをコンパイルし、様々な環境で動作 K E Y F E A T U R E S Neo-AI デバイスランタイム・コンパイラはオープンソース (Apache license 2.0) ランタイムは DL フレームワークの 1/10 のサイズ https://github.com/neo-ai/

Slide 61

Slide 61 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Parse Model Optimize Tensors Generate Code Optimize Graph TensorFlow, MXNet, PyTorch, XGBoost のモデルを共通 フォーマットに変換 ML モデル (NN) 中のパターンを 認識し、実行コストを削減する ようグラフ構造の最適化 入力データの shape から パターンを抽出し、 効率的にメモリを割り当てる ターゲットデバイス用に 低レベルコンパイラを 用いて機械語を生成 Neo コンパイラ (TVM / treelite) Pruning Operator fusion Nested loop tiling Vectorization / Tensorization Data layout transform

Slide 62

Slide 62 text

© 2019, Amazon Web Services, Inc. or its Affiliates. まとめ • Amazon SageMaker で機械学習のワークフローを構築 • 開発・トレーニング・デプロイの自然な流れを整備 • SageMaker Python SDK と Docker コンテナ • ワークフロー自動化で継続的なモデル更新と運用負荷の削減 • AWS Step Functions や Apache Airflow などのワークフロー管理ツールで • Amazon SageMaker Ground Truth によるアノテーションも • 効率の良い推論のためシナリオに沿った適切な選択肢を選ぶ • リアルタイムかバッチか、遅延はどれくらい許容できるかによって Batch Transform Job, Amazon Elastic Inference, Amazon SageMaker Neo

Slide 63

Slide 63 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker 新機能

Slide 64

Slide 64 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 機械学習モデルを素早く大規模に構築・トレーニング・デプロイ Amazon SageMaker Studio IDE Amazon SageMaker Ground Truth アルゴリズム・ フレームワーク SageMaker Notebooks SageMaker Experiments トレーニング・ チューニング デプロイ・ ホスティング 強化学習 ML マーケット プレイス SageMaker Debugger SageMaker Autopilot SageMaker Model Monitor NEW! NEW! NEW! NEW! NEW! NEW! Neo

Slide 65

Slide 65 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker re:Invnet 2019 でのアップデート Amazon SageMaker Studio Amazon SageMaker Notebooks (Preview) Amazon SageMaker Debugger Amazon SageMaker Experiments Amazon SageMaker Model Monitor Amazon SageMaker Autopilot

Slide 66

Slide 66 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Studio • 現在オハイオリージョンで利用可能 機械学習のための初めての統合開発環境 (IDE)

Slide 67

Slide 67 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Notebooks (preview) • Single Sign-On (SSO) で簡単アクセス • フルマネージドでセキュア • セットアップ不要 • 簡単にコラボレーション • URL をシェアしてノートブックを共有 • フレキシブル • 計算リソースの増減 (coming soon) 素早く立ち上がり共有可能なノートブック

Slide 68

Slide 68 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Processing • 完全マネージド • クラスターでの分散処理 • カスタム処理 • 特徴量エンジニアリングに自前のスクリプトを持ち込み • コンテナ • SageMaker ビルトイン or BYOC • セキュリティ・コンプライアンス • 自動起動・終了 データ処理とモデル評価のための分析ジョブ

Slide 69

Slide 69 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Experiments • パラメータ・メトリクスを実験・ユーザーをまたぎトラッキング・可視化 • チーム・ゴール・仮説ごとに実験をまとめられる • Experiments SDK を利用してカスタムメトリクスを定義。結果を分析用 Pandas Dataframe フォーマットで出力可能 実験管理・トラッキング・比較

Slide 70

Slide 70 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Debugger • 関連データ (メトリクス・混同行列・学習勾配) のリアルタイム取得と、分析・ デバッグ • 自動でエラー検知。アラートによる生産性の向上 分析・デバッグ、説明性とアラートの生成

Slide 71

Slide 71 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Model Monitor • 自動データ収集 • エンドポイントにデプロイしたモデルのデータを収集 • 継続的モニタリング • 予め設定したベースラインに対して定期的にテストを実施し、 結果に関する統計情報や品質の問題を集計しレポートを S3 に出力 • 柔軟なルール • データのドリフトをビルトインのルールで検知したり、独自ルールを設定 • Deequ (データの Unit test) • SageMaker Studio での可視化 • CloudWatch との統合 プロダクション運用するモデルの継続的なモニタリング Model

Slide 72

Slide 72 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon SageMaker Autopilot • 表形式のデータに対する機械学習をすぐに始める • クラス分類と回帰のためのモデルを自動的に生成する AutoML サービス • 自動でモデル生成 • 自動の特徴量エンジニアリング・モデルチューニング。Autopilot を起動する と最初にデータセットをスキャンし、最適な処理ステップやアルゴリズムを 発見するために複数回のトライアルを実行する • 可視性とコントロール • 現在 XGBoost と線形学習器をサポート • データセットに関する情報と、ジョブ詳細が S3 に出力され、再利用やカスタ マイズが可能 モデルの自動生成と完全な可視性・コントロール Amazon SageMaker Model + Python Code Data

Slide 73

Slide 73 text

© 2019, Amazon Web Services, Inc. or its Affiliates. SageMaker Operator for Kubernetes • SageMaker でモデルのトレーニング・チューニング・デプロイ • Kubernetes 環境で ML ワークロードのオーケストレーション • Kubernetes でパイプラインとワークフローの作成 • SageMaker 側でインフラを完全にマネージ • Managed Spot Training や分散学習にも対応 Kubernetes ご利用のお客様も Amazon SageMaker でモデルをトレーニング・チューニング・デプロイ Amazon SageMaker Kubernetes

Slide 74

Slide 74 text

© 2019, Amazon Web Services, Inc. or its Affiliates. References • Event info [Web] • Amazon SageMaker 事例祭り [Web#1, Blog#2, #3, #4, #5, #6, #7, #8] • ML@Loft [next slide] • AWS Black Belt Online Seminar • Basic [Movie, Slides] • Advanced [Movie, Slides] • AWS ブログ: Keras [Blog#1, #2], Apache Airflow [Blog], Kubeflow [Blog], • HPO: SageMaker default [Blog], Optuna [Blog] • オンプレ資産の GPU がある人 [Blog] • SageMaker Containers [GitHub] • Jupyter 以外のエディター/IDE 使いたい場合は、その環境に [SageMaker Python SDK] を⼊れて API 叩く

Slide 75

Slide 75 text

© 2019, Amazon Web Services, Inc. or its Affiliates. これまでの ML@Loft イベント内容 https://ml-loft.connpass.com/ これまでのイベント内容は登壇者のスライド付きで 開催報告ブログにまとめてあります #1. MLOps #2. MLOps #3. レコメンド #4. Edge #5. NLP #6. MLPP との共催, 参加者の方の Blog #7. ユーザー分析 #8. 量子コンピュータ #9. Deep Learning フレームワークと推論 #MLLoft

Slide 76

Slide 76 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Thank You! [email protected] @_hariby