Red Hat Forum 2014 のIBMセッション資料です。
「ビッグデータの即時活用を実現するJava高速処理OpenStackプラットフォーム」
http://redhatforum2014.jp/
https://redhatmktg.smktg.jp/public/session/view/18
This document introduces deep reinforcement learning and provides some examples of its applications. It begins with backgrounds on the history of deep learning and reinforcement learning. It then explains the concepts of reinforcement learning, deep learning, and deep reinforcement learning. Some example applications are controlling building sway, optimizing smart grids, and autonomous vehicles. The document also discusses using deep reinforcement learning for robot control and how understanding the principles can help in problem setting.
5. ? 2015-2017 Research Institute of Systems Planning, Inc.
1.Brainwaveとは
? Brainwave(プレビュー版)はざっくり言うと
? FPGAとは、書き換え可能な H/Wですが、
Brainwave(プレビュー版)では、ユーザーは
自由には FPGAを書き換えられません
4
FPGA上にあらかじめ実装された
CNNのモデルを
ネット越しに叩いて
推論させようという代物
6. ? 2015-2017 Research Institute of Systems Planning, Inc.
1.Brainwaveとは
? Brainwave(プレビュー版)は概ね以下の手順で使
用します
1. ローカルで推論モデルを記述する
- 必要に応じて、リモートからモデルをダウンロードします
2. リモートにデプロイする
3. リモートでサービスを実行する
? それぞれ以下の技術に立脚しています
1. 推論モデルの記述 ??? Tensorflow
2. デプロイ ??? REST API
3. リモートサービス ??? gRPC
5
7. ? 2015-2017 Research Institute of Systems Planning, Inc.
6
1.Brainwaveとは
Tensorflow の
Graphにする
? プレビュー版でできることの例:画像の分類
? 推論処理の基本は3段階
① 画像を前処理する
② 特徴量を抽出する
③ クラス分類を行う
? 上記を行う Graph を リモートにデプロイする
? gRPC で、画像を送りつけて、上記を叩いて、
結果をもらう
ZIPで
固める
… CPU実行
… CPU実行
… FPGA実行
snow leopard, ounce, Panthera uncia confidence: 0.85421455
leopard, Panthera pardus confidence: 0.13914554
cheetah, chetah, Acinonyx jubatus confidence: 0.0020039019
lynx, catamount confidence: 0.0019892405
great grey owl, great gray owl, Strix nebulosa confidence:
0.0011571224
リモートにデプロイ
8. ? 2015-2017 Research Institute of Systems Planning, Inc.
1.Brainwaveとは
? 真ん中の特徴量抽出だけが FPGA実行
? クラス分類は CPU実行
? ユーザーは特徴量抽出は高速にFPGAで実行して、
判別器や分類器は自分で自由に構築できるとい
うこと
7
① 画像を前処理する
② 特徴量を抽出する
③ クラス分類を行う
… CPU実行
… CPU実行
… FPGA実行
ここがミソ
10. ? 2015-2017 Research Institute of Systems Planning, Inc.
Pipeline
Tensorflow Tensorflow
Stage Stage
CPU
Brainwave
Stage
2.チュートリアル(00)を理解する
? REST API,gRPCはラッパーに完全に隠蔽
? Tensorflowのコードがかろうじて顔を出す程度
? つまり、何をやってるか細かいことは全然わかりません
? Tensorflow の Graph は Pipeline に隠蔽されてます
10
ResNet50
Featurizer
snow leopard, ounce, Panthera
uncia confidence: 0.85421455
leopard, Panthera pardus
confidence: 0.13914554
cheetah, chetah, Acinonyx jubatus
confidence: 0.0020039019
lynx, catamount confidence:
0.0019892405
great grey owl, great gray owl, Strix
nebulosa confidence: 0.0011571224
前処理
特
徴
量
ResNet50
Classifier
11. ? 2015-2017 Research Institute of Systems Planning, Inc.
2.チュートリアル(00)を理解する
? Stageとは?
– 下記の3種類の Stageがあります
1. TensorflowStage
2. BrainWaveStage
3. KerasStage
? このうち、BrainWaveStage は FPGAで実行され、他の
2つは CPUで実行されます
? チュートリアルでは、以下の構成になってます
1. 画像の前処理 … TensorFlowStage
2. 特徴量抽出 … BrainWaveStage
3. クラス分類 … TensorFlowStage
11
12. ? 2015-2017 Research Institute of Systems Planning, Inc.
2.チュートリアル(00)を理解する
? リモートモデル
– ResNet50による Featurizer,Classifierのモデルが
提供されています
– チュートリアルでは、これらをダウンロードして、
Classifier を Pipelineに接続した後に、リモートに
アップロードしています
– Featurizer はリモートの FPGAで動くので、アップ
ロードしません
? では、何でダウンロードするのか? というと、ローカ
ルで Pipeline がちゃんと動くか確認するときなどに使
えるようです
12
13. ? 2015-2017 Research Institute of Systems Planning, Inc.
2.チュートリアルでやってること
? チュートリアルでやってることのまとめ
13
チュートリアルの見出し 概要
1 Image_processing 前処理の定義
2 Featurizer リモートモデルの download
3 Classifier 上記モデルから Classifier の Graph作成
4 Service Definition Stage を Pipeline List に Append
デプロイ用の zipファイル作成
5 Deploy REST API発行準備
Zipファイルのアップロード
デプロイ
6 Client Clientを作る
Imagenet のラベル情報をゲット
gRPC でリモートの Predictサービスを実行し
て結果を表示
14. ? 2015-2017 Research Institute of Systems Planning, Inc.
BRAINWAVE を動かせるよう
にするまで
14
15. ? 2015-2017 Research Institute of Systems Planning, Inc.
2.Brainwave を動かせるようにするまで
https://github.com/Azure/aml-real-time-ai
Azure ML Hardware Accelerated Models Quickstartより
(1) Azure の(無料)アカウントを作る
(2) MMA(Model Management Account)を作る
(3) quota を申請する
(4) 返事を待つ
(5) 待っている間に環境構築
(6) SSL 接続の準備
(7) 返事が来る
(8) Jupyter notebook の起動
15
16. ? 2015-2017 Research Institute of Systems Planning, Inc.
2.Brainwave を動かせるようにするまで
? 参考サイト
https://github.com/Azure/aml-real-time-ai/blob/master/README.md
https://github.com/Azure/aml-real-time-ai/blob/master/docs/README.md#set-up-environment
https://docs.microsoft.com/ja-jp/azure/machine-learning/service/quickstart-installation
https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-deploy-fpga-web-service
? サイトにより少しずつ書いてあることが異なるので
ご注意ください
? ラッパークラスの中身についてはこちらが詳しいで
す。Microsoft エバンジェリスト松崎剛さんの記事
です
https://tsmatz.wordpress.com/2018/05/22/project-brainwave-fpga-realtime-prediction-service-in-azure-machine-learning-model-management/
17
17. ? 2015-2017 Research Institute of Systems Planning, Inc.
(1) Azure の(無料)アカウントを作る
? 画面キャプチャし忘れたので絵はありません
? 初めてだと怖かった点
– クレジットカード番号を入れろと言われる
? 冷やかし対策です
? 無料期間を過ぎて、有料アカウントに移行しなかっ
たら、ちゃんと何も請求されなかったので御安心を
– 電話番号を入れろと言われる
? ベリフィケーションコードを貰うためです
? PHSの番号を入れてもちゃんとSMSが送られてきま
した
? 恐れることは何もないです
18
18. ? 2015-2017 Research Institute of Systems Planning, Inc.
(2) MMA(Model Management Account)を作る
19
? Azure Portal 画面
machine learning
19. ? 2015-2017 Research Institute of Systems Planning, Inc.
(2) MMA(Model Management Account)を作る
21
名前系は適当に違う
名前を設定
Free_experiment
Free_resource
など
Free Trialを選択
米国東部 2
「招待」を選択して、
自分を招待
S1 を選択
20. ? 2015-2017 Research Institute of Systems Planning, Inc.
(3)quota を申請する(4)返事を待つ(6)返事が来る
22
? フォームにMMAの情報を入力して、いく
つかのアンケートに回答して送信
? 多分、FPGAを利用するためのリソースを
確保するための手続き
? 1回目は2日半ほどで、2回目は5日後に
「FPGA quota allocated」のメールが届きま
した
? ここの情報が必要に? Azure Portal → すべてのリソース? MMA選択? フォームに入力
21. ? 2015-2017 Research Institute of Systems Planning, Inc.
(5) 待っている間に環境構築
? 環境構築の手順は下記を参考に、
https://github.com/Azure/aml-real-time-ai/blob/master/docs/README. md#set-up-environment
? 上記では miniconda をインストールしているが、私は、
anaconda3 をインストールして、下記の作業を実施
(1) Brainwave の環境一式を github からクローンする
(2) Brainwave 実行用の環境を作る
- anaconda3/envs/amlrealtimeai 配下に環境が構築されます
- du で amlrealtimeal の使用量を見たら驚きの2G超でした
(3) Brainwave 実行用の環境に切り替える
– 戻すときは、conda deactivate とする
23
git clone https://github.com/Azure/aml-real-time-ai
conda env create -f aml-real-time-ai/amlrealtimeai.yml
conda activate amlrealtimeai
22. ? 2015-2017 Research Institute of Systems Planning, Inc.
(6) SSL 接続の準備
? ここには、SSL接続の設定をしろと書いてあり
ますが、特に何もしないでもチュートリアルは
動きます
https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-deploy-fpga-web-service
? 間違った使い方をしているといけないので、自
己責任でお願いします
24
23. ? 2015-2017 Research Institute of Systems Planning, Inc.
(8) Jupyter notebook の起動
? Amlrealtimeai の環境で起動
? チュートリアルのnotebookは、以下にあります
aml-real-time-ai/notebooks/resnet50
? 初回起動時は下記のようなメッセージに従い token
を入力します。2回目以降は不要です
VCopy/paste this URL into your browser when you connect for the first time, to login with a token:
http://localhost:8888/?token=bb2ce89cc8ae931f5df50f96e3a6badfc826ff4100e78075
? 環境によって、
– Running at「0.0.0.0:8080」と出るが、そこでは接続できず、例
えば「localhost:8080」でないとダメだったり、
– Running at「localhost:8888」と出て、そのままでOKだったり、
色々なので適宜対応ください
25
jupyter notebook
24. ? 2015-2017 Research Institute of Systems Planning, Inc.
(8) Jupyter notebook の起動
? チュートリアル画面
26
25. ? 2015-2017 Research Institute of Systems Planning, Inc.
Appendix:料金確認
27
日毎
MMA
FPGA
Storage
無料分の総額 残額
■Azure Potal
→ すべてのサービス
→ サブスクリプション
→ Free Trial を選択
26. ? 2015-2017 Research Institute of Systems Planning, Inc.
ご清聴ありがとうござました
ISP www.isp.co.jp
技ラボ wazalabo.isp.co.jp
28