sd-turbo β Core ML, 384Γ384, 6-bit (Apple Neural Engine)
Powered by Stability AI
A Core ML conversion of stabilityai/sd-turbo,
compiled and quantized to run on-device on iPhone via the Apple Neural Engine.
Measured on a real device: ~2.2 s per image on an iPhone 13 mini (A15), no crashes.
β οΈ The Stability AI Materials in this repository have been changed. See
NOTICEfor the full list of modifications.
Why this exists
The published Core ML conversions of sd-turbo are compiled for Mac GPU
(ORIGINAL attention), shipped uncompressed (fp16, ~2.5 GB), and locked to
resolutions we could not use. Those three properties are baked in at conversion
time and cannot be changed at runtime.
This conversion targets the opposite end: a phone. It trades away flexibility β one fixed resolution, no guidance, no img2img β for a bundle that fits in memory on a 4 GB iPhone and runs on the Neural Engine.
Conversion parameters
Every value below is compiled in and cannot be changed at runtime.
| Parameter | Value | Why |
|---|---|---|
| Resolution | 384 Γ 384 (latent 48 Γ 48) | 512 renders subjects too small; 256 crops too tightly |
| Attention | SPLIT_EINSUM (v1) |
Targets the Neural Engine. SPLIT_EINSUM_V2 requires the latent width to be a multiple of 512, so it cannot do 384 |
| Quantization | 6-bit palettized (text encoder + U-Net) | VAE decoder left at fp16 β it is small and quality-sensitive |
| U-Net batch size | 1 | sd-turbo does not use classifier-free guidance; batch 2 doubles the work for nothing (measured: 2.07Γ faster at batch 1) |
| VAE encoder | not included | Text-to-image only |
| Compute units | CPU_AND_NE |
Produced with apple/ml-stable-diffusion:
python -m python_coreml_stable_diffusion.torch2coreml \
--model-version stabilityai/sd-turbo \
--convert-unet --convert-text-encoder --convert-vae-decoder \
--attention-implementation SPLIT_EINSUM \
--quantize-nbits 6 \
--latent-h 48 --latent-w 48 \
--unet-batch-one \
--bundle-resources-for-swift-cli \
--compute-unit CPU_AND_NE
Runtime settings
These are not compiled in, but the bundle only behaves correctly with them:
| Setting | Value |
|---|---|
| Scheduler | LCM (see the caveat below) |
| Steps | 4 |
| Guidance scale | 0.0 |
| Compute units | cpuAndNeuralEngine |
reduceMemory |
true on iPhone |
β οΈ Upstream
apple/ml-stable-diffusionhas no LCM schedulerLCM support has been open and unmerged since 2024 (apple/ml-stable-diffusion#319). To use this model you need
LCMScheduler.swift, which exists in keijiro's fork. Cherry-picking the single commitbd0cb9eonto currentapple/mainis enough β it is ~180 lines, and the three conflicts are each one extracasein aswitch.
Contents
17 files, 1,072,200,142 bytes (~1.07 GB) total.
βββ manifest.json β integrity + version metadata
βββ TextEncoder.mlmodelc/ 304 MB
βββ Unet.mlmodelc/ 620 MB
βββ VAEDecoder.mlmodelc/ 94 MB
βββ vocab.json
βββ merges.txt
.mlmodelc entries are directories, not files. They are stored here
unarchived so that a client can stream them file-by-file and reconstruct the
tree, rather than downloading a ~1 GB archive and needing ~2 GB of free space to
unpack it.
manifest.json
{
"schemaVersion": 1,
"modelVersion": "1.0.0",
"totalBytes": 1072200142,
"files": [
{ "path": "Unet.mlmodelc/weights/weight.bin", "bytes": 650117120, "sha256": "..." }
]
}
Fetch this small file first to get the download size up front, verify each file
with its SHA-256 as it lands, and detect when a newer modelVersion is
published. Files are served at:
https://huggingface.co/jivenchy/sd-turbo-coreml-384-6bit/resolve/main/<path>
License
This model is licensed under the Stability AI Community License. Copyright Β© Stability AI Ltd. All Rights Reserved.
- Full text:
LICENSE.md - Attribution and the complete list of modifications:
NOTICE
Your own use of this model is governed by that license. Two provisions are easy to miss:
- Commercial use requires registration with Stability AI at https://stability.ai/community-license.
- The license terminates if you or your affiliates generate more than USD $1,000,000 in annual revenue; an enterprise license is then required (https://stability.ai/enterprise).
Use is also subject to the Stability AI Acceptable Use Policy.
This is an unofficial community conversion. It is not affiliated with, endorsed by, or supported by Stability AI or Apple.
Model tree for jivenchy/sd-turbo-coreml-384-6bit
Base model
stabilityai/sd-turbo