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
680
RubyではじめるGraphQL
hatappi
0
880
TDDな個人開発
hatappi
0
320
できるだけ楽して楽しくRails開発しよう
hatappi
2
340
EKSにRailsをのせた
hatappi
1
1.2k
RubyとApache Arrow
hatappi
0
2.4k
Red Chainerを なぜ作って今後どうするのか
hatappi
2
2.4k
Fargateで夢は見られるのか
hatappi
1
2.2k
個人サービスをFargateに移行したよ
hatappi
1
690
Other Decks in Technology
See All in Technology
様々なファイルシステム
sat
PRO
0
130
現場データから見える、開発生産性の変化コード生成AI導入・運用のリアル〜 / Changes in Development Productivity and Operational Challenges Following the Introduction of Code Generation AI
nttcom
1
450
Zephyr(RTOS)にEdge AIを組み込んでみた話
iotengineer22
1
280
QA業務を変える(!?)AIを併用した不具合分析の実践
ma2ri
0
110
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3k
ヘンリー会社紹介資料(エンジニア向け) / company deck for engineer
henryofficial
0
330
もう外には出ない。より快適なフルリモート環境を目指して
mottyzzz
13
9.1k
Digitization部 紹介資料
sansan33
PRO
1
5.6k
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
310
Railsの話をしよう
yahonda
0
170
[2025年10月版] Databricks Data + AI Boot Camp
databricksjapan
1
240
OpenTelemetry が拡げる Gemini CLI の可観測性
phaya72
2
1.9k
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1371
200k
4 Signs Your Business is Dying
shpigford
185
22k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Leading Effective Engineering Teams in the AI Era
addyosmani
7
580
Docker and Python
trallard
46
3.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Cost Of JavaScript in 2023
addyosmani
55
9.1k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Practical Orchestrator
shlominoach
190
11k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3k
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໘നͦ͏ͳͷͰΓ͍ͨ
• ࠓޙ։ൃଓ͚Δ༧ఆͳͷͰஆ͔͍Ͱݟक͍͚ͬͯͨͩΔ ͱخ͍͠Ͱ͢