Published blog post: MAX Graph API Tutorials
For the time being, the versions used in this blog is MAX nightly
max 2024.7.1505 (ba28802f)
Modular version 2024.7.1505-ba28802f-release
-
Install the MAX SDK.
-
git clone this repo and
python3 -m venv venv && source venv/bin/activate
python3 -m pip install --find-links "$(modular config max.path)/wheels" max-engine
python3 -m pip install -r requirements.txt
- Run the code such as
mojo add.mojo
andmojo matmul.mojo
. For mnist, first need to train the model withpython mnist.py
(uses relu) orpython mnist.py --use-relu6
to train with relu6. Then for inference and checking test accuracy matches the PyTorch version, runmojo mnist.mojo
(uses relu) or for relu6 custom op (needspython mnist.py --use-relu6
to train with relu6), ensure to runmojo package custom_ops
and follow withmojo mnist.mojo --use-relu6
.
Note: mojo build mnist.mojo
builds the mnist
binary and we can execute the binary via ./mnist
- If you encounter any issues, please make sure to check out the roadmap and known issues first