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
Mojo Dojo
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Henry Cui
October 28, 2023
Programming
260
0
Share
Mojo Dojo
Henry Cui
October 28, 2023
More Decks by Henry Cui
See All by Henry Cui
プロダクション言語モデルの情報を盗む攻撃 / Stealing Part of a Production Language Model
zchenry
1
250
Direct Preference Optimization
zchenry
0
450
Diffusion Model with Perceptual Loss
zchenry
0
510
レンズの下のLLM / LLM under the Lens
zchenry
0
230
Go with the Prompt Flow
zchenry
0
220
ことのはの力で画像の異常検知 / Anomaly Detection by Language
zchenry
0
700
驚愕の事実!LangChainが抱える問題 / Problems of LangChain
zchenry
0
310
MLOps初心者がMLflowを触る / MLflow Brief Introduction
zchenry
0
190
{{guidance}}のガイダンス / Guidance of guidance
zchenry
0
200
Other Decks in Programming
See All in Programming
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
290
GoogleCloudとterraform完全に理解した
terisuke
1
160
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
350
煩雑なSkills管理をSoC(関心の分離)により解決する――関心を分離し、プロンプトを部品として育てるためのOSSを作った話 / Solving Complex Skills Management Through SoC (Separation of Concerns)
nrslib
4
1k
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
590
t *testing.T は どこからやってくるの?
otakakot
1
710
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
240
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
110
[RubyKaigi 2026] Require Hooks
palkan
1
230
iOS機能開発のAI環境と起きた変化
ryunakayama
0
190
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
650
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
160
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.4k
Technical Leadership for Architectural Decision Making
baasie
3
340
Code Review Best Practice
trishagee
74
20k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
340
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
190
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
140
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.7k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
200
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Transcript
Mojo Dojo 機械学習の社会実装勉強会第28回 Henry 2023/10/28
WELCOME 2
Barbie Mojo ▪ Modular社がリリースしたPythonのスーパーセット ▪ Modular社の共同創業者・CEO Chris Lattner は、今まで SwiftやTPUなどを携わってきた
▪ MojoはPythonより何倍も速い! ▪ スーパーセットなので、既存のPytorchなどのコードもそのまま 動く! ▪ Pythonの柔軟性を維持しつつ、Rustにあるような厳密性も! 3
Mojo Toolbox ▪ Mojo driver • 実行シェル • 実行ファイルのビルドも •
Linux版とMac版がすでにリリース • 今日主に見ていく ▪ VS Code 拡張 • 文法ハイライトなど ▪ Jupyter kernel • Mojo notebookが書ける ▪ デバッグツール(未公開) 4
Mojoのインストール ▪ https://developer.modular.com/download から ▪ アカウント作成が必要 ▪ 認証コード付きのURLが生成される ▪ https://github.com/modularml/mojo/tree/main/examples
• 認証コードを使ったDocker環境も作れます 5
Hello World ▪ Mojo ▪ mainで名付けているので、別途呼び出さなくて良い ▪ mojo buildで単体で実行可能なファイルをビルド ▪
Pythonファイルの場合、怒られる • mojo hello.py ▪ mojo: error: no such command 'hello.py' • mojo build hello.py ▪ mojo: error: cannot open 'hello.py', since it does not appear to be a Mojo file (it does not end in '.mojo' or '.🔥') • mojo hello_py.mojoの場合は文法エラー 6
Hello Worldの時間 ▪ timeコマンドで計測 ▪ python hello.py は 0.017s ▪
mojo hello.mojo は 0.089s ▪ ./hello はなんと 0.005s 7
matmulベンチマーク ▪ https://github.com/modularml/mojo/blob/main/examples/m atmul.mojo に用意されている ▪ 比較用のPythonはナイーブな行列掛け算しか実装されてない ▪ mojoのほうは様々な最適化が施されている 8
matmulベンチマーク ▪ ビルド自体は0.825s ▪ ビルドした実行ファイルを実行時に下記のエラーになることが ある • Mojo/Python interoperability error:
Unable to locate a suitable libpython, please set `MOJO_PYTHON_LIBRARY` • https://github.com/modularml/mojo/issues/551 を参考に、export MOJO_PYTHON_LIBRARY="/usr/lib/x86_64-linux-gnu/libpython3 .8.so" してからビルドし直すことで解決 9
matmulベンチマーク ▪ 恐ろしい実行結果 • mojo matmul.mojo • ./matmul 10
matmulベンチマーク ▪ Pythonでforループをやめて、np.matmulを使う場合 • それでも速かった 11
まとめ ▪ mojoの紹介 ▪ 簡単なベンチマーク 12