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
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
260
Direct Preference Optimization
zchenry
0
470
Diffusion Model with Perceptual Loss
zchenry
0
530
レンズの下のLLM / LLM under the Lens
zchenry
0
240
Go with the Prompt Flow
zchenry
0
240
ことのはの力で画像の異常検知 / Anomaly Detection by Language
zchenry
0
740
驚愕の事実!LangChainが抱える問題 / Problems of LangChain
zchenry
0
330
MLOps初心者がMLflowを触る / MLflow Brief Introduction
zchenry
0
220
{{guidance}}のガイダンス / Guidance of guidance
zchenry
0
210
Other Decks in Programming
See All in Programming
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
560
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
160
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
550
Foundation Models frameworkで画像分析
ryodeveloper
1
610
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
3
780
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
260
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
650
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
490
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
230
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
140
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
170
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
500
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
67k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
480
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Designing for Performance
lara
611
70k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
119
120k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
430
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
990
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
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