Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ONNXハンズオン
Search
NearMeの技術発表資料です
PRO
May 24, 2024
110
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ONNXハンズオン
NearMeの技術発表資料です
PRO
May 24, 2024
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
AIエージェントのための 隔離された安全なインフラ設計
nearme_tech
PRO
0
38
Claude Code × git worktree で並列開発 (続き) -差分のサービスだけを併設する-
nearme_tech
PRO
1
76
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
84
LLM + 強化学習
nearme_tech
PRO
0
42
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
120
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
79
初めてのLean言語
nearme_tech
PRO
0
140
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
53
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
99
Featured
See All Featured
Test your architecture with Archunit
thirion
2
2.5k
From π to Pie charts
rasagy
1
430
Facilitating Awesome Meetings
lara
57
7.2k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
The Language of Interfaces
destraynor
162
27k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
Six Lessons from altMBA
skipperchong
29
4.6k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
560
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
460
How GitHub (no longer) Works
holman
316
150k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
490
Transcript
0 ONNXハンズオン 2024-05-24 第91回NearMe技術勉強会 Takuma KAKINOUE
1 ONNXとは • Open Neural Network eXchangeの略 • ある機械学習フレームワークで訓練したモデルを、統⼀されたフォーマットに 出⼒し(.onnxファイル)、ONNXランタイムが含まれる任意の環境で推論を実
⾏可能にしようというもの • 例えば、Pythonで訓練したPytorchのNNモデルを使って、TypeScriptやC#上 でも推論(not 訓練)が実⾏可能になる ◦ TypeScriptやC#の環境の中にはONNXランタイムさえインストールされて いれば良い ※ web: https://onnx.ai/ ※ github: https://github.com/onnx/onnx ※ .onnxファイルはProtocol Buffers形式
2 ONNX概略図 ONNXランタイム ONNX Model Zoo 訓練済みモデルをpull 自前で訓練して エクスポート .onnx
ファイル 推論実行 ※ クラウドストレージ等でも可 実行ホストは、 マイコンやコンシューマー ゲーム機など無限の可能 性!! 訓練済みモデルを ダウンロードして 使用可! 今回のハンズオンではPytorchで自前で訓練
3 ONNXハンズオン • Pythonで⼿書き⽂字を認識するモデルをPytorchで学習し、Javascriptのwebアプリ上 から推論を⾏う ◦ サンプルのレポジトリ:
[email protected]
:kakky-hacker/sandbox.git • ⼿順 ◦
git clone
[email protected]
:kakky-hacker/sandbox.git ◦ cd sandbox/onnx-test ◦ pip install -r requirements.txt ◦ python train.py ▪ mnist.onnxが⽣成される ◦ python -m http.server 8000 ◦ ブラウザからhttp://localhost:8000にアクセス
4 ONNXハンズオン • Canvasに適当な数字を書いてPredictボタンを押すと予測結果が表⽰される 正しく予測できた!
5 ONNXの注意点 • opsetバージョンが存在し、モデルをエクスポートする時に注意しなければならない (https://github.com/onnx/onnx/blob/main/docs/Operators.md) • 全ての演算オペレータが実装されているわけではない ◦ ⼀応、カスタムオペレータという⼿段は存在する •
当たり前だが、推論速度は推論を⾏うハードウェアに依存する ◦ 訓練するハードウェアと推論するハードウェアのマシンスペック差はちゃんと考慮 しなければならない ▪ ONNXランタイムはGPU対応 ▪ ちなみにONNXランタイム⾃体もそこまで遅くなさそう (https://qiita.com/john-rocky/items/caa55453f40f5f444edf)
6 Thank you