Run large language models like LLaMA or Mistral locally on a Mac with an M-series chip.
Fine-tune an existing language model on your own data using LoRA directly on your Mac.
Generate images on a Mac using Stable Diffusion without any cloud API or GPU server.
Transcribe audio to text on-device using a Whisper model via the MLX audio example.
Requires an Apple Silicon Mac (M1/M2/M3) and the MLX framework, model weights are downloaded separately from Hugging Face.
This repository is a collection of example projects that demonstrate how to use MLX, Apple's machine learning framework for Apple Silicon chips (the M-series processors). Each example is a standalone script or small project focused on a specific task or model type, so you can read and run them independently without needing to understand the whole collection first. The examples cover a wide range of AI and machine learning tasks. On the text side, there are examples for training a language model from scratch, running large language models like LLaMA and Mistral, fine-tuning models with low-rank adaptation (LoRA), text classification with BERT, and a mixture-of-experts model. For images, there are examples for generating images with Stable Diffusion and FLUX, classifying images, and an autoencoder. Audio examples include speech recognition using OpenAI's Whisper model, audio compression with Meta's EnCodec, and music generation with MusicGen. There are also multimodal examples that combine text and images, including CLIP for joint embeddings, LLaVA for answering questions about images, and the Segment Anything model for image segmentation. The starting point recommended for newcomers is the MNIST digit classification example, which is simpler than the large model examples and shows the basic patterns of the MLX framework. The repository also points to a separate, more complete package called MLX LM for anyone who wants a fuller toolset for working with language models. Model weights for many of the examples are available through the MLX Community organization on Hugging Face, where the community also shares converted versions of public models ready to run with these scripts. The framework itself was developed at Apple by a small team of researchers.
← ml-explore on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.