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
Henry Cui
October 28, 2023
Programming
0
240
Mojo Dojo
Henry Cui
October 28, 2023
Tweet
Share
More Decks by Henry Cui
See All by Henry Cui
プロダクション言語モデルの情報を盗む攻撃 / Stealing Part of a Production Language Model
zchenry
1
240
Direct Preference Optimization
zchenry
0
430
Diffusion Model with Perceptual Loss
zchenry
0
480
レンズの下のLLM / LLM under the Lens
zchenry
0
210
Go with the Prompt Flow
zchenry
0
190
ことのはの力で画像の異常検知 / Anomaly Detection by Language
zchenry
0
660
驚愕の事実!LangChainが抱える問題 / Problems of LangChain
zchenry
0
290
MLOps初心者がMLflowを触る / MLflow Brief Introduction
zchenry
0
170
{{guidance}}のガイダンス / Guidance of guidance
zchenry
0
190
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
370
atmaCup #23でAIコーディングを活用した話
ml_bear
4
730
AHC061解説
shun_pi
0
300
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
あなたはユーザーではない #PdENight
kajitack
4
300
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
150
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
310
浮動小数の比較について
kishikawakatsumi
0
370
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
4
460
今、アーキテクトとして 品質保証にどう関わるか
nealle
0
200
Event Storming
hschwentner
3
1.3k
AIプロダクト時代のQAエンジニアに求められること
imtnd
2
640
Featured
See All Featured
Scaling GitHub
holman
464
140k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Design in an AI World
tapps
0
160
Being A Developer After 40
akosma
91
590k
エンジニアに許された特別な時間の終わり
watany
106
240k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Darren the Foodie - Storyboard
khoart
PRO
3
2.7k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
98
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
78
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
110
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
340
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