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.4k
RubyでChainerつくってます!!
Chainer Meetup #09
#chug_jp
hatappi
March 30, 2019
Tweet
Share
More Decks by hatappi
See All by hatappi
Cloudflare を活用して変わったメルカリの開発体験 / How Cloudflare Changed Mercari's Development Experience
hatappi
1
610
RubyではじめるGraphQL
hatappi
0
840
TDDな個人開発
hatappi
0
300
できるだけ楽して楽しくRails開発しよう
hatappi
2
330
EKSにRailsをのせた
hatappi
1
1.2k
RubyとApache Arrow
hatappi
0
2.3k
Red Chainerを なぜ作って今後どうするのか
hatappi
2
2.3k
Fargateで夢は見られるのか
hatappi
1
2.2k
個人サービスをFargateに移行したよ
hatappi
1
680
Other Decks in Technology
See All in Technology
ハッカー視点で学ぶサイバー攻撃と防御の基本
nomizone
3
1.5k
dbt Cloudの新機能を紹介!データエンジニアリングの民主化:GUIで操作、SQLで管理する新時代のdbt Cloud
sagara
0
180
Data Hubグループ 紹介資料
sansan33
PRO
0
1.8k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
12k
Vibe Codingの裏で、 考える力をどう取り戻すか
csekine
2
640
AIエージェントのフレームワークを見るときの個人的注目ポイント
os1ma
1
480
Grafana MCP serverでなんかし隊 / Try Grafana MCP server
kohbis
0
310
エンジニア採用から始まる技術広報と組織づくり/202506lt
nishiuma
8
1.5k
やさしい認証認可
minorun365
PRO
29
12k
脅威をモデリングしてMCPのセキュリティ対策を考えよう
flatt_security
4
1.2k
マルチテナント+マルチプロダクト SaaS への AI Agent の組み込み方
kworkdev
PRO
2
230
データ戦略部門 紹介資料
sansan33
PRO
1
3.2k
Featured
See All Featured
Done Done
chrislema
184
16k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
680
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Embracing the Ebb and Flow
colly
85
4.7k
4 Signs Your Business is Dying
shpigford
183
22k
Six Lessons from altMBA
skipperchong
28
3.8k
Adopting Sorbet at Scale
ufuk
77
9.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
The Art of Programming - Codeland 2020
erikaheidi
54
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໘നͦ͏ͳͷͰΓ͍ͨ
• ࠓޙ։ൃଓ͚Δ༧ఆͳͷͰஆ͔͍Ͱݟक͍͚ͬͯͨͩΔ ͱخ͍͠Ͱ͢