MAX Examples
Ready-to-use code examples using MAX APIs
Llama 3 text generation
A complete implementation of the Llama3 large language model, written in Mojo, with the MAX Graph API.
Llama 2 text generation
A complete implementation of the Llama2 large language model, written in Mojo, with the MAX Graph API.
Replit code completion
A complete implementation of the Replit Code V1.5 3B large language model, written in Mojo, with the MAX Graph API.
Quantized TinyLlama
A 4-bit quantized version of a small Llama2 model, trained on the TinyStories dataset, written in Mojo, with the MAX Graph API.
Mistral-7b text generation
Generates new text from a prompt, using the MAX Engine Python API and Mistral-7b from ONNX.
Stable Diffusion image generation
A multi-model AI pipeline for image generation, using the MAX Engine Mojo API and StableDiffusion-1.4 from ONNX.
Stable Diffusion image generation
A multi-model AI pipeline for image generation, using the MAX Engine Python API and StableDiffusion-1.4 from ONNX.
BERT text prediction
Predicts masked text in a string, using the MAX Engine Python API and a BERT PyTorch model from HuggingFace.
BERT text prediction
Predicts masked text in a string, using the MAX Engine C API and a BERT PyTorch model from HuggingFace.
ResNet image classification
Classifies an image, using the MAX Engine Python API and a ResNet-50 PyTorch model from HuggingFace.
YOLOv8 segmentation
Segments objects in an image, using the MAX Engine Python API and the YOLOv8 Segmentation with a webcam.
Custom ops for MAX Graph and ONNX
Two examples of how to write custom graph ops with Mojo (for a loaded model and a MAX Graph model).
MAX Graph basics
A very simple model (it does nothing useful) showing how to build a model with the MAX Graph API.