Slide 1

Slide 1 text

RubyͰChainerͭͬͯ͘·͢!! @Chainer Meetup #9

Slide 2

Slide 2 text

2 • Yusaku Hatanaka • Merpay Inc. • Backend Engineer • GoΛॻ͍͍ͯΔ͜ͱ͕ଟ͍ • ϓϥΠϕʔτ • RubyΛॻ͍͍ͯΔ͜ͱ͕ଟ͍ • Anket: RailsΛ࢖ͬͨSlackͷΞϯέʔταʔϏε • Red Chainer: ʁʁʁʁ
 ↑ࠓ೔͸͜ͷ࿩Λ͠·͢
 self introduction @hatappi

Slide 3

Slide 3 text

3 Red Chainer??

Slide 4

Slide 4 text

4 + Chainer

Slide 5

Slide 5 text

5 Red Chainer

Slide 6

Slide 6 text

6 • Rubyのための深層学習フレームワーク • GitHub: red-data-tools/red-chainer • PythonでかかれたChainerをRubyへポーティング Red Chainer ͱ͸? Chainer Red Chainer NumPy Numo::NArray
 (ruby-numo/numo-narray) CuPy cumo (sonots/cumo)

Slide 7

Slide 7 text

7 ✓ Activation
 Relu, Sigmoid, LeakyReLU, LogSoftmax, Tanh ✓ loss
 SoftMaxEntropy, MeanSquaredError ✓ noise
 Dropout ✓ Normalization
 BatchNormalization ✓ Pooling
 AveragePooling2D, MaxPooling2D ✓ etc
 Chainerͷఏڙ͢ΔVariable΍TrainerͳͲ ͷ֤छAPIΛ༻ҙ͍ͯ͠·͢ ݱঢ়Կ͕Ͱ͖Δͷ͔ ֤छAPIͷఏڙ αϯϓϧ ✓ MNIST ✓ CIFAR 10, 100 ✓ Iris

Slide 8

Slide 8 text

8 ͳͥRed Chainer Λ࡞Γ͸͡Ίͨͷ͔

Slide 9

Slide 9 text

ある⽇ Red Data Tools という プロジェクトに出会う

Slide 10

Slide 10 text

10 Red Data Tools • Ruby⽤のデータ処理ツールを提供するプロジェクト • 2017年2⽉に発⾜ • 活動例 • Apache Arrow本体への開発の参加やRubyのbinding • Charty, Red Datasets, Red Chainer, etc • 毎⽉1回のオフラインMeetupをやっている • 次回は4/9!! • https://speee.connpass.com/event/124079/ https://red-data-tools.github.io/ja/

Slide 11

Slide 11 text

11 Red Data Tools Policy 1. Collaborate across the Ruby community 2. Acting rather than blaming 3. Continuous, iterative progress rather than a short, big project 4. The current lack of knowledge doesn't matter 5. Ignore criticism from outsiders 6. Fun!

Slide 12

Slide 12 text

参加するのは良いけど ⾃分は何をしよう

Slide 13

Slide 13 text

Rubyで深層学習ができたら ⾯⽩いのでは

Slide 14

Slide 14 text

ただそれだけですw

Slide 15

Slide 15 text

15 Ͳ͏΍ͬͯ ϙʔςΟϯάͨ͠ͷ͔

Slide 16

Slide 16 text

16 2017/08 2017/10 2018/05 2019/03 Red Chainer ͷྺ࢙

Slide 17

Slide 17 text

17 2017/08 First Commit 2017/10 2018/05 2019/03 Red Chainer ͷྺ࢙

Slide 18

Slide 18 text

18 First Commit 2017/08

Slide 19

Slide 19 text

19 First Commit • Chainer v2ͷίʔυΛͻͨ͢ΒಡΉ • Python΄ͱΜͲॻ͍ͨ͜ͱͳ͍ͷͰPythonͷυΩϡϝϯτಡ Έͳ͕Βͻͨ͢ΒϙʔςΟϯά • ྫ͑͹࠷ॳ͸ˣ͕ͲΜͳڍಈʹͳΔ͔෼͔ΒͣυΩϡϝϯτ ΛಡΉͳͲ͢ΔͨΊ͕͔͔࣌ؒΔ • ͳΕͯ͘Δͱ಄ͷதͰม׵Ͱ͖ΔΑ͏ʹͳΔ

Slide 20

Slide 20 text

20 2017/08 First Commit 2017/10 2018/05 2019/03 Red Chainer ͷྺ࢙

Slide 21

Slide 21 text

21 2017/08 First Commit 2017/10 First release 2018/05 2019/03 Red Chainer ͷྺ࢙

Slide 22

Slide 22 text

22 First Release • Multi Layer Perceptron(MLP)ʹඞཁͳ࠷௿ݶͷAPIΛαϙʔτ • ಈ͘΋ͷ͕Ͱ͖ͨʂʂ

Slide 23

Slide 23 text

DEMO

Slide 24

Slide 24 text

24

Slide 25

Slide 25 text

25 2017/08 First Commit 2017/10 First release 2018/05 2019/03 Red Chainer ͷྺ࢙

Slide 26

Slide 26 text

26 2017/08 First Commit 2017/10 First release 2018/05 ৞ΈࠐΈԋࢉΛαϙʔτ 2019/03 Red Chainer ͷྺ࢙

Slide 27

Slide 27 text

27 ৞ΈࠐΈԋࢉͷαϙʔτ • ը૾ࣝผ͍ͨ͠ʂʂʂ • BatchNormalization, Pooling, etc.. ͳͲͷAPIΛ௥Ճ • CIFAR-10, 100ͷαϯϓϧͷ௥Ճ • Ϟσϧ͸VGG, ResNet18 • ՄࢹԽͨ͘͠ͳΔ • ྫ͑͹ը૾ࣝผΛRed ChainerͰߦͬͯepoch͝ͱͷਫ਼౓ΛՄ ࢹԽ͍ͨ͠

Slide 28

Slide 28 text

DEMO

Slide 29

Slide 29 text

29 1epoch 45epoch

Slide 30

Slide 30 text

30 2017/08 First Commit 2017/10 First release 2018/05 ৞ΈࠐΈԋࢉΛαϙʔτ 2019/03 Red Chainer ͷྺ࢙

Slide 31

Slide 31 text

31 2017/08 First Commit 2017/10 First release 2018/05 ৞ΈࠐΈԋࢉΛαϙʔτ 2019/03 Chainer 3ܥ΁ͷରԠ Red Chainer ͷྺ࢙

Slide 32

Slide 32 text

32 Chainer 3ܥ΁ͷରԠ • Chainer3ܥͰऔΓࠐ·ΕͨPRΛͬ͟ͱݟͯͲΜ ͳରԠ͕ඞཁ͔Λ೺Ѳ͢Δ • ChainerͷGithub releasesݟ΍ͯ͘͢ॿ͔Γ ·ͨ͠ • 1೔1࣌ؒ͘Β͍͔͕࣌ؒ͠ͱΕͳ͍ͷͰ Trello Ͱ؅ཧͭͭ͠๨Εͳ͍Α͏ʹ͠ͳ͕Βਐḿͤ͞ Δ

Slide 33

Slide 33 text

33 ͿͬͪΌ͚࢖͑Δͷʁ

Slide 34

Slide 34 text

34 ͿͬͪΌ͚࢖͑Δͷʁ MNIST (epoch: 20, unit: 1000, batchsize: 100) શepochʹ͔͔ͬͨඵ਺ 0 2000 4000 6000 8000 Numo::NArray Numo::NArray with OpenBLAS numpy 408.025 s 784.824 s 7415.42 s

Slide 35

Slide 35 text

35 ଎౓໘ͷ՝୊ • ಺෦ͷॲཧͰແବͳ෦෼͕ͳ͍͔͸ௐ͕ࠪඞཁ • NumPyʹ͸͋ͬͯNumo::NArrayʹ͸ͳ͍ϝιουΛҰ෦Ruby ͷੈքʹ΋͖͍ͬͯͯΔ(Arrayʹม׵ͯ͠ॲཧ͍ͯ͠Δ)ͷͰ Numo::NArrayͰ׬݁Ͱ͖ΔΑ͏ʹ͢Δ • ͳͲͳͲվળͰ͖Δͱ͜Ζ͸͋Γͦ͏ • ͡ɺ͔͡Μ͕ɻɻɻ

Slide 36

Slide 36 text

36 ࠓޙʹ͍ͭͯ • 4ܥରԠ΋͍͖ͯ͠·͢$ • ONNX͕࢖͑ΔΑ͏ʹͳΓ͍ͨ <= ࠓணख͠͸͡Ίͯ·͢ • ONNX • open neural network exchange format • ྫ͑͹ChainerͰֶशͨ͠ϞσϧΛMXNetͰऔΓࠐΜͰ࢖ ͏͜ͱ͕ग़དྷΔ • Red ChainerͰ΋࢖͑ΔΑ͏ʹͳΕ͹طଘͷࢿ࢈Λ࢖͏͜ͱ ͕Ͱ͖ΔͷͰخ͍͠͸ͣ

Slide 37

Slide 37 text

37 ·ͱΊ

Slide 38

Slide 38 text

38 ·ͱΊ • RubyͰChainerΛ࡞ͬͯ·͢ • v2͔ΒϙʔςΟϯάͯ͠࠷ۙv3ʹରԠ͠·ͨ͠ • ଎౓໘ͷ՝୊͸͋ΔͷͰվળ͍ͨ͠ • ONNX໘നͦ͏ͳͷͰ΍Γ͍ͨ • ࠓޙ΋։ൃ͸ଓ͚Δ༧ఆͳͷͰஆ͔͍໨Ͱݟक͍͚ͬͯͨͩΔ ͱخ͍͠Ͱ͢