深層学習ライブラリのプログラミングモデル

  • View
    83.359

  • Download
    0

  • Category

    Software

Preview:

Citation preview

深層学習ライブラリのプログラミングモデル

1

2015-12-19 @Chainer Meetup

今日の内容• 自己紹介

• プログラミングモデル

• ただ結局…

2

自己紹介

3

自己紹介• バクフー株式会社 柏野 雄太 (かしの ゆうた)

• 大規模リアルタイムデータのプラットフォーム

5

http://socio.bakfoo.com/socio@bakfoo.com

Closed Beta

プログラミングモデル

7

汎用高機能DLライブラリ• Theano

• Torch

• Chainer

• neon

• TensorFlow+ / Cloud Vision API

• MXNet

DL lib 機能差・競争優位

theano torch chainer neon TF MXNet

single speed ○ ○ ○*

multi gpu ○ ○ ○ ○ ○ ○

multi machine ○* ○

model zoo ○ ○ ○ ○

community ○ ○ ○

DLライブラリの共通点• 神経回路網の数理表現をモデルとする

• 有向非巡回グラフ(DAG): 計算グラフ

…1

1

1b(3)

b(2)

b(1)W (1)

W (2)

W (3)

x1 x2 xd

a

(1)(x)

a

(2)(x)

a

(3)(x)

h

(2)(x)

h

(1)(x)

f(x) = h

(3)(x)

g

g

o

b(1)W (1)

b(3)

b(2)

W (2)

W (3)

x

数理表現の実装に差がある

• 手続き的: Torch, Chainer, neon

• シンボル的: Theano, TensorFlow

• 手続きかつシンボル: MXNet

_ + _

A

_ + _

_ **2 B

1

A2 +B + 1

モデル実装の差

_ + _

A

_ + _

_ **2 B

1

A2 +B + 1

手続き的モデリング• ノードにデータ(とgrad)が格納される

_ + _

A

_ + _

_ **2 B

1

A2 +B + 1

ノードに格納されるとは• Chainerのカスタム関数

手続きは柔軟で動的

• 全ノードに値とgradが格納されているのでデバグが容易

• forなどの制御が容易

• Chainerのように実行しながら,計算グラフを組み替えることもできる

シンボル的モデリング• 変数ノードはシンボル

• 計算グラフをコンパイル・実行して結果を得る

A2 +B + 1

_ + _

A

_ + _

_ **2 B

1

シンボルはメモリを再利用する• 結果が欲しいだけなら入力と最後だけメモリにあればいい:メモリの再利用

• A, B: 120byte

• 手続き: 5*120 = 600 byte

• シンボル:3*120 = 360 byte

_ + _

A

_ + _

_ **2 B

1

シンボルは計算グラフを効率化• 計算グラフの畳みこみ

_ + _

A

_ + _

_ **2 B

1

A B 1

op

op = A ⇤ ⇤2 +B + 1

シンボル:資源分散を体系化

• TFのデバイス間計算,マシン分散機能

手続き vs シンボル• 手続きは柔軟で動的

• デバグが容易でモデリングの開発効率がいい

• モデルに制御構文,計算グラフを動的にも

• シンボルは効率的

• メモリの再利用

• 計算グラフの構造を畳みこみできる

• 計算資源の分散に体系的に対応できる参考:http://mxnet.readthedocs.org/en/latest/program_model.html

ただ結局…

TF開発エコシステム• TensorDebugger (TDB) https://github.com/ericjang/tdb

TF開発エコシステム• skflow https://github.com/google/skflow

• Pretty Tensor https://github.com/google/prettytensor

• Keras http://keras.io/backend/

• Deep Learning Robot https://www.autonomous.ai/deep-learning-robot

結局,七難隠すのは…

開発エコシステムの大きさ

Chainerコミュニティはどこ?

http://jrvis.com/red-dwarf/?user=pfnet&repo=chainer

Rubyの成功に学ぼう• まずは日本で開発エコシステムのコアを育てる

• 本体コード外のコミュニティ開発者の養成

• 正式ドキュメントに日本語

• 日本語による頻繁なミートアップ・年一回のChainerカンファレンス

• 日本語のQAコミュニティ

ご質問・ご意見

kashino@bakfoo.com

27

@yutakashino

DL学習リソース

28

動画講義 (全力でオススメ)

• Deep Learning Summer School 2015

• Hugo Larochelle (Twitter/U of Sherbrooke)

• Nando de Freitas (Oxford)

• CS231n: CNN for Visual Recognition

• CS224d: DL for Natural Language Processing

http://videolectures.net/deeplearning2015_montreal/

http://cs231n.stanford.edu/

http://cs224d.stanford.edu/index.html

https://www.cs.ox.ac.uk/people/nando.defreitas/machinelearning/

https://goo.gl/UWtRWT

29

書籍• 古典: Bengio et.al. 2015 DLBook

• Theano Tutorial

• Neural Networks and Deep Learning

• 岡谷貴之著 深層学習 (機械学習プロ)

• 神嶌敏弘編 深層学習: Deep Learning

http://www.iro.umontreal.ca/~bengioy/dlbook/

http://neuralnetworksanddeeplearning.com/

http://deeplearning.net/tutorial/deeplearning.pdf

30

例:手続きback prop

• 手続きだと簡単実装

Recommended