Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RubyでChainerつくってます!!
Search
hatappi
March 30, 2019
Technology
2
1.3k
RubyでChainerつくってます!!
Chainer Meetup #09
#chug_jp
hatappi
March 30, 2019
Tweet
Share
More Decks by hatappi
See All by hatappi
RubyではじめるGraphQL
hatappi
0
780
TDDな個人開発
hatappi
0
260
できるだけ楽して楽しくRails開発しよう
hatappi
2
300
EKSにRailsをのせた
hatappi
1
1.1k
RubyとApache Arrow
hatappi
0
2.2k
Red Chainerを なぜ作って今後どうするのか
hatappi
2
2.2k
Fargateで夢は見られるのか
hatappi
1
2k
個人サービスをFargateに移行したよ
hatappi
1
620
Rails + TypeScript + React + Hypernovaで始めるSSRライフ
hatappi
1
1.9k
Other Decks in Technology
See All in Technology
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
530
なぜCodeceptJSを選んだか
goataka
0
160
UI State設計とテスト方針
rmakiyama
2
320
Qiita埋め込み用スライド
naoki_0531
0
860
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
生成AIのガバナンスの全体像と現実解
fnifni
1
180
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
kargoの魅力について伝える
magisystem0408
0
200
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
520
39k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Cost Of JavaScript in 2023
addyosmani
45
7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
GraphQLとの向き合い方2022年版
quramy
44
13k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
It's Worth the Effort
3n
183
28k
Why Our Code Smells
bkeepers
PRO
335
57k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Transcript
RubyͰChainerͭͬͯ͘·͢!! @Chainer Meetup #9
2 • Yusaku Hatanaka • Merpay Inc. • Backend Engineer
• GoΛॻ͍͍ͯΔ͜ͱ͕ଟ͍ • ϓϥΠϕʔτ • RubyΛॻ͍͍ͯΔ͜ͱ͕ଟ͍ • Anket: RailsΛͬͨSlackͷΞϯέʔταʔϏε • Red Chainer: ʁʁʁʁ ↑ࠓ͜ͷΛ͠·͢ self introduction @hatappi
3 Red Chainer??
4 + Chainer
5 Red Chainer
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)
7 ✓ Activation Relu, Sigmoid, LeakyReLU, LogSoftmax, Tanh ✓ loss
SoftMaxEntropy, MeanSquaredError ✓ noise Dropout ✓ Normalization BatchNormalization ✓ Pooling AveragePooling2D, MaxPooling2D ✓ etc Chainerͷఏڙ͢ΔVariableTrainerͳͲ ͷ֤छAPIΛ༻ҙ͍ͯ͠·͢ ݱঢ়Կ͕Ͱ͖Δͷ͔ ֤छAPIͷఏڙ αϯϓϧ ✓ MNIST ✓ CIFAR 10, 100 ✓ Iris
8 ͳͥRed Chainer Λ࡞Γ͡Ίͨͷ͔
ある⽇ Red Data Tools という プロジェクトに出会う
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/
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!
参加するのは良いけど ⾃分は何をしよう
Rubyで深層学習ができたら ⾯⽩いのでは
ただそれだけですw
15 Ͳ͏ͬͯ ϙʔςΟϯάͨ͠ͷ͔
16 2017/08 2017/10 2018/05 2019/03 Red Chainer ͷྺ࢙
17 2017/08 First Commit 2017/10 2018/05 2019/03 Red Chainer ͷྺ࢙
18 First Commit 2017/08
19 First Commit • Chainer v2ͷίʔυΛͻͨ͢ΒಡΉ • Python΄ͱΜͲॻ͍ͨ͜ͱͳ͍ͷͰPythonͷυΩϡϝϯτಡ Έͳ͕Βͻͨ͢ΒϙʔςΟϯά •
ྫ͑࠷ॳˣ͕ͲΜͳڍಈʹͳΔ͔͔ΒͣυΩϡϝϯτ ΛಡΉͳͲ͢ΔͨΊ͕͔͔࣌ؒΔ • ͳΕͯ͘Δͱ಄ͷதͰมͰ͖ΔΑ͏ʹͳΔ
20 2017/08 First Commit 2017/10 2018/05 2019/03 Red Chainer ͷྺ࢙
21 2017/08 First Commit 2017/10 First release 2018/05 2019/03 Red
Chainer ͷྺ࢙
22 First Release • Multi Layer Perceptron(MLP)ʹඞཁͳ࠷ݶͷAPIΛαϙʔτ • ಈ͘ͷ͕Ͱ͖ͨʂʂ
DEMO
24
25 2017/08 First Commit 2017/10 First release 2018/05 2019/03 Red
Chainer ͷྺ࢙
26 2017/08 First Commit 2017/10 First release 2018/05 ΈࠐΈԋࢉΛαϙʔτ 2019/03
Red Chainer ͷྺ࢙
27 ΈࠐΈԋࢉͷαϙʔτ • ը૾ࣝผ͍ͨ͠ʂʂʂ • BatchNormalization, Pooling, etc.. ͳͲͷAPIΛՃ •
CIFAR-10, 100ͷαϯϓϧͷՃ • ϞσϧVGG, ResNet18 • ՄࢹԽͨ͘͠ͳΔ • ྫ͑ը૾ࣝผΛRed ChainerͰߦͬͯepoch͝ͱͷਫ਼ΛՄ ࢹԽ͍ͨ͠
DEMO
29 1epoch 45epoch
30 2017/08 First Commit 2017/10 First release 2018/05 ΈࠐΈԋࢉΛαϙʔτ 2019/03
Red Chainer ͷྺ࢙
31 2017/08 First Commit 2017/10 First release 2018/05 ΈࠐΈԋࢉΛαϙʔτ 2019/03
Chainer 3ܥͷରԠ Red Chainer ͷྺ࢙
32 Chainer 3ܥͷରԠ • Chainer3ܥͰऔΓࠐ·ΕͨPRΛͬ͟ͱݟͯͲΜ ͳରԠ͕ඞཁ͔ΛѲ͢Δ • ChainerͷGithub releasesݟͯ͘͢ॿ͔Γ ·ͨ͠
• 11࣌ؒ͘Β͍͔͕࣌ؒ͠ͱΕͳ͍ͷͰ Trello Ͱཧͭͭ͠Εͳ͍Α͏ʹ͠ͳ͕Βਐḿͤ͞ Δ
33 ͿͬͪΌ͚͑Δͷʁ
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
35 ໘ͷ՝ • ෦ͷॲཧͰແବͳ෦͕ͳ͍͔ௐ͕ࠪඞཁ • NumPyʹ͋ͬͯNumo::NArrayʹͳ͍ϝιουΛҰ෦Ruby ͷੈքʹ͖͍ͬͯͯΔ(Arrayʹมͯ͠ॲཧ͍ͯ͠Δ)ͷͰ Numo::NArrayͰ݁Ͱ͖ΔΑ͏ʹ͢Δ • ͳͲͳͲվળͰ͖Δͱ͜Ζ͋Γͦ͏
• ͡ɺ͔͡Μ͕ɻɻɻ
36 ࠓޙʹ͍ͭͯ • 4ܥରԠ͍͖ͯ͠·͢$ • ONNX͕͑ΔΑ͏ʹͳΓ͍ͨ <= ࠓணख͠͡Ίͯ·͢ • ONNX
• open neural network exchange format • ྫ͑ChainerͰֶशͨ͠ϞσϧΛMXNetͰऔΓࠐΜͰ ͏͜ͱ͕ग़དྷΔ • Red ChainerͰ͑ΔΑ͏ʹͳΕطଘͷࢿ࢈Λ͏͜ͱ ͕Ͱ͖ΔͷͰخ͍ͣ͠
37 ·ͱΊ
38 ·ͱΊ • RubyͰChainerΛ࡞ͬͯ·͢ • v2͔ΒϙʔςΟϯάͯ͠࠷ۙv3ʹରԠ͠·ͨ͠ • ໘ͷ՝͋ΔͷͰվળ͍ͨ͠ • ONNX໘നͦ͏ͳͷͰΓ͍ͨ
• ࠓޙ։ൃଓ͚Δ༧ఆͳͷͰஆ͔͍Ͱݟक͍͚ͬͯͨͩΔ ͱخ͍͠Ͱ͢