Repo of the Day
MochiDiffusion/MochiDiffusion
Published: Apr 5, 2023
Open repository ↗Run Stable Diffusion on Mac natively
Summary
Mochi Diffusion is a native macOS app written in Swift and SwiftUI that runs Stable Diffusion and FLUX.2 Klein image generation entirely on local Apple Silicon hardware. It wraps Apple's Core ML Stable Diffusion implementation for SD models and the Iris pipeline for FLUX.2 Klein, with optional acceleration through the Apple Neural Engine or Metal GPU.
What it is useful for
The app is a practical option for engineers and creators who need image generation without sending data to remote services. Because all inference runs on-device, it fits work on private datasets, offline environments, or behind restrictive networks. Output is written as PNG with generation metadata that AUTOMATIC1111-compatible tools and Civitai uploads can read, so assets integrate with existing Stable Diffusion workflows rather than being locked into a custom format.
Mochi Diffusion is also a reference point for engineers exploring Core ML deployment on Apple Silicon. The README documents two compute unit configurations: "CPU & Neural Engine" for low memory use and "CPU & GPU" which may be faster on M1 Max, Ultra, and later. Each Core ML SD model is compiled for a fixed image size that is baked in during conversion, which is an important constraint when planning model pipelines. ControlNet is supported, and FLUX.2 Klein accepts up to four input images per generation, with the app automatically resizing them to fit the pipeline's attention budget.
How engineers can use it
To get started, download the app from the project's releases page. Mochi Diffusion looks for models in ~/MochiDiffusion/models/ by default, with the location configurable in Settings.
For Stable Diffusion, you need Core ML-converted models. The split_einsum variant works with all compute unit options including Neural Engine, while the original variant is restricted to CPU & GPU. Models are available from the coreml-community Hugging Face repositories or via the wiki conversion guide. A typical layout:
~/MochiDiffusion/models/stable-diffusion-2-1_split-einsum_compiled/
merges.txt, TextEncoder.mlmodelc, Unet.mlmodelc,
VAEDecoder.mlmodelc, VAEEncoder.mlmodelc, vocab.json
For FLUX.2 Klein, no conversion is needed. Download the text_encoder, tokenizer, transformer, and vae folders from the FLUX.2-klein-4B or FLUX.2-klein-9B Hugging Face repos and place them under ~/MochiDiffusion/models/flux-klein-4b/.
First-time use of a Core ML model can take up to two minutes while the Neural Engine compiles a cached version, after which subsequent generations are faster. Building from source requires Apple Silicon, macOS 15.6 or later, and Xcode 26.0 or later, with a sibling SharedXcodeSettings/DeveloperSettings.xcconfig file for signing. Compatibility is limited to Apple Silicon, so the app will not run on Intel Macs. The project is licensed under GPL-3.0 and collects no telemetry.