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
RubyではじめるGraphQL
hatappi
0
810
TDDな個人開発
hatappi
0
280
できるだけ楽して楽しくRails開発しよう
hatappi
2
310
EKSにRailsをのせた
hatappi
1
1.1k
RubyとApache Arrow
hatappi
0
2.2k
Red Chainerを なぜ作って今後どうするのか
hatappi
2
2.3k
Fargateで夢は見られるのか
hatappi
1
2.1k
個人サービスをFargateに移行したよ
hatappi
1
640
Rails + TypeScript + React + Hypernovaで始めるSSRライフ
hatappi
1
2k
Other Decks in Technology
See All in Technology
Amazon Athenaから利用時のGlueのIcebergテーブルのメンテナンスについて
nayuts
0
100
サイト信頼性エンジニアリングとAmazon Web Services / SRE and AWS
ymotongpoo
7
1.7k
JAWS FESTA 2024「バスロケ」GPS×サーバーレスの開発と運用の舞台裏/jawsfesta2024-bus-gps-serverless
ma2shita
3
280
あなたが人生で成功するための5つの普遍的法則 #jawsug #jawsdays2025 / 20250301 HEROZ
yoshidashingo
2
320
ABWG2024採択者が語るエンジニアとしての自分自身の見つけ方〜発信して、つながって、世界を広げていく〜
maimyyym
1
190
アジャイルな開発チームでテスト戦略の話は誰がする? / Who Talks About Test Strategy?
ak1210
1
660
Introduction to OpenSearch Project - Search Engineering Tech Talk 2025 Winter
tkykenmt
2
150
"TEAM"を導入したら最高のエンジニア"Team"を実現できた / Deploying "TEAM" and Building the Best Engineering "Team"
yuj1osm
1
230
いまからでも遅くない!コンテナでWebアプリを動かしてみよう!コンテナハンズオン編
nomu
0
170
クラウド食堂とは?
hiyanger
0
120
30→150人のエンジニア組織拡大に伴うアジャイル文化を醸成する役割と取り組みの変化
nagata03
0
200
E2Eテスト自動化入門
devops_vtj
1
100
Featured
See All Featured
Building an army of robots
kneath
303
45k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
650
Building Applications with DynamoDB
mza
93
6.2k
Six Lessons from altMBA
skipperchong
27
3.6k
Agile that works and the tools we love
rasmusluckow
328
21k
Practical Orchestrator
shlominoach
186
10k
Docker and Python
trallard
44
3.3k
A better future with KSS
kneath
238
17k
Done Done
chrislema
182
16k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
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໘നͦ͏ͳͷͰΓ͍ͨ
• ࠓޙ։ൃଓ͚Δ༧ఆͳͷͰஆ͔͍Ͱݟक͍͚ͬͯͨͩΔ ͱخ͍͠Ͱ͢