← Back to Leaderboard
Mapple-aiml-research

apple-aiml-research/ml-stable-diffusion

Core ML conversion and Swift inference for on-device Stable Diffusion on Apple Silicon

View on GitHub ↗
AI FrameworkQuickstart ↓
Engineering Health (Methodology)
B+ · 70/100
Maintenance Activity
● Updated 2mo ago
Latest Release
1.1.1
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance20/35
Fork Adoption19/25
Release Cadence11/20
License Clarity20/20
Local AICLI
Total Stars
★ 17,956
24h Growth
+0
7d Growth
+1
Forks
1,073

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

apple-aiml-research/ml-stable-diffusion Star History (2022-11-30 - 2026-12-03) ALL-TIME STAR HISTORY (2022-11 – 2026-12) +18k in 1464d · avg +12/day 19k 9.5k 0 2022-11-30: ★ 12023-03-04: ★ 5,4502023-06-03: ★ 11,7122023-09-02: ★ 13,7492023-12-02: ★ 14,7412024-03-02: ★ 15,3142024-06-01: ★ 15,8122024-08-31: ★ 16,1792024-11-30: ★ 16,5282025-03-01: ★ 16,8002025-05-31: ★ 17,0072025-08-30: ★ 17,2662025-11-29: ★ 17,4362026-02-28: ★ 17,6022026-05-30: ★ 17,7392026-08-29: ★ 17,9082026-12-03: ★ 17,956 ★ 18k 2022-11 2024-12 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

The framework separates model preparation from application inference. python_coreml_stable_diffusion converts PyTorch components into Core ML artifacts through torch2coreml and offers a Python generation path using Hugging Face Diffusers. The dependency manifest specifies coremltools>=8.0, diffusers[torch]==0.30.2, transformers==4.44.2, and diffusionkit==0.4.0; PyTorch is also listed separately without a version pin.

Package.swift defines the Swift integration side: add StableDiffusion to an Xcode project or exercise the model with StableDiffusionSample. The handoff is a model resource bundle, not a Python service or network API. The artifacts depend on the model family: SDXL conversion can include a base and optional refiner, whereas SD3 Medium uses DiffusionKit-assisted tooling for an MMDiT denoiser and a 16-channel VAE decoder, with an option to bundle a preconverted T5 encoder alongside the converted text encoders.

Key Capabilities & Differentiators

Preconverted weights cover SD 1.4, 1.5, 2 Base, 2.1 Base, and SDXL Base, with six-bit variants for the listed SD 1.x and 2.x models and mixed-bit variants for SDXL. SDXL has a Swift refiner path, and SD3 Medium has a conversion recipe for 1024×1024 and a Swift --sd3 inference mode. Custom conversion can apply fixed-bit palettization to the UNet and text encoder; mixed-bit palettization instead chooses bit widths layer by layer using denoised-latent PSNR. Calibrated UNet activation quantization selectively uses W8A8 on less sensitive layers and W8A16 on more sensitive ones.

The 512×512 SD 2.1 Base benchmark paired CPU_AND_NE with SPLIT_EINSUM_V2, recording median end-to-end latencies of 18.5 s on iPhone 12 Mini, 7.9 s on iPhone 14 Pro Max, and 7.0 s on M2 iPad Pro. These were medians of five back-to-back runs on 2023 beta software, not current performance guarantees or estimates for SDXL or SD3.

Trade-offs & Limitations

Compared with direct PyTorch/Diffusers execution, this stack gives Apple applications a native Core ML runtime but makes checkpoint changes a conversion and validation task. Compared with hosted inference, it can keep prompts and images on-device, at the cost of distributing model resources and operating within client memory and compute limits. For SDXL, ORIGINAL is recommended for CPU plus GPU on Mac, and SPLIT_EINSUM for CPU plus Neural Engine on iPhone and iPad. The V2 attention path that performs well in the SD 2.1 benchmark is discouraged for XL because compilation takes too long.

The mobile SDXL recommendation is 768×768 rather than the default 1024×1024. The converter also forces float32 for the original SDXL VAE to avoid known float16 overflow; account for that precision choice in device tests. Mixed-bit pre-analysis can take hours on one MPS or CUDA GPU, and latent PSNR is not a substitute for inspecting images from representative prompts. In a deployment review, measure both first-run and repeated-run latency and peak memory for the exact artifact you will ship. The repository's MIT license does not settle the licensing of separately distributed weights.

Hardware & Deployment Guide

For an initial app test, use matching Core ML weights from Hugging Face and validate the resources with the Swift CLI before integrating the package into Xcode. For a custom checkpoint, install the Python project with pip install -e ., convert with the flags for its model family, and use --bundle-resources-for-swift-cli to prepare the Swift resources. Downloads and conversion are setup steps; once the model resources are in place, generation can run on-device without a hosted inference endpoint or a Python runtime in the Swift app.

The baseline runtime minima are macOS 13.1 and iOS/iPadOS 16.2. The memory-improved compressed-weight path targets macOS 14 and iOS/iPadOS 17, where compressed weights can be decompressed at execution time rather than in advance when the model loads. These OS floors do not guarantee that every model fits on every supported device. Release 1.0.0 introduced six-bit compression and SPLIT_EINSUM_V2; 1.1.0 added Swift SDXL refiner inference and Python SDXL base inference; 1.1.1 switched the code to MIT and fixed safety-checker dtype and mixed-bit tooling issues.

Integration boundary: Python exports Core ML artifacts; StableDiffusion and StableDiffusionSample consume bundled resources on the Swift side.
Model coverage: Preconverted SD 1.x, SD 2.x, and SDXL weights are available; SD3 Medium has a DiffusionKit-assisted conversion path and Swift --sd3 mode.
Mobile SDXL: --latent-h 96 --latent-w 96 targets 768×768; SPLIT_EINSUM is recommended for CPU plus Neural Engine, while V2 is discouraged for XL compilation.
Compression: Fixed-bit palettization targets the UNet and text encoder; mixed-bit analysis selects per-layer bit widths using denoised-latent PSNR.
Activation quantization: Calibrated UNet sensitivity analysis supports selective W8A8 versus W8A16 for Neural Engine optimization on hardware such as A17 Pro and M4.
Measured baseline: At 512×512 with SD 2.1 Base, CPU plus Neural Engine and SPLIT_EINSUM_V2 yielded median end-to-end times of 7.9 s on iPhone 14 Pro Max and 7.0 s on M2 iPad Pro.
Best For

Apple-platform teams shipping local image generation in a Swift app or testing Core ML model bundles from the CLI on target devices.

Skip If

You need one inference runtime across Apple and non-Apple platforms, frequently change model components without a conversion step, or cannot budget client storage and memory for model assets.

Reviewed on 2026-12-01 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Local AICLI
conda create -n coreml_stable_diffusion python=3.8 -y
conda activate coreml_stable_diffusion
cd /path/to/cloned/ml-stable-diffusion/repository
pip install -e .

Comparison vs. Top Voice, Vision & Video Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
ml-stable-diffusion ★18k+1PythonMITCore ML conversion and Swift inference for on-device Stable Diffusion on Apple S
whisperX26.5k+677PythonBSD-2-ClauseBatched Whisper with forced alignment for word timings and optional speaker labe
hypit32.4k+731TypeScript—An SVML framework and CLI for turning video references into reusable workflows
diffusers35k+36PythonApache-2.0A modular PyTorch SDK for running and customizing multimodal diffusion pipelines

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/apple-aiml-research/ml-stable-diffusion.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

apple-aiml-research/ml-stable-diffusion Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about ml-stable-diffusion

How do I move a checkpoint from Python into a Swift app?

Use a compatible preconverted Core ML model or export a checkpoint with python_coreml_stable_diffusion.torch2coreml. For your own conversion, --bundle-resources-for-swift-cli packages the resources consumed by StableDiffusionSample. Test that bundle with the CLI, then add the StableDiffusion Swift package to your Xcode project and provide the corresponding model resources. The Swift runtime does not need the Python conversion environment.

How should I size memory and test runtime overhead?

There is no single memory or VRAM figure that applies across model families, resolutions, compression settings, and compute units. Measure peak memory and end-to-end latency on the oldest supported device using the actual bundle and intended concurrency. For mobile SDXL, the 768×768 and mixed-bit configurations are reasonable starting points to evaluate, not guarantees that the model will fit or run fast enough.

Does MIT cover commercial deployment and redistribution of the weights?

Release 1.1.1 changed the repository code license to MIT. That does not grant rights to a separately downloaded checkpoint, custom VAE, or bundled text encoder. Check the terms of each model artifact for commercial use and redistribution before shipping. Local inference keeps generation off a hosted inference API, but it does not change those obligations.

When is Core ML a better fit than direct Diffusers or a hosted API?

Choose Core ML when the product needs native Swift integration and on-device execution on Apple hardware. Stay with PyTorch and Diffusers when you primarily need to swap research checkpoints or pipeline components without preparing a new Core ML bundle. Choose a hosted API if avoiding client-side model storage and memory pressure matters more than offline operation and keeping prompts on-device.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining apple-aiml-research/ml-stable-diffusion? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature apple-aiml-research/ml-stable-diffusion on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare