---
title: "Using Stable Diffusion with Core ML on Apple Silicon"
description: "Stable Diffusion can run on Apple Silicon via Core ML using Apple's ml-stable-diffusion repo, with pre-converted checkpoints for v1.4, v1.5, v2 base and v2.1 base hosted on the Hugging Face Hub."
url: "https://swe.quest/articles/using-stable-diffusion-with-core-ml-on-apple-silicon-ec28c0373922e17b"
canonical: "https://huggingface.co/blog/diffusers-coreml"
source: "Hugging Face"
published: "2022-12-01"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["inference","computer-vision","swift","python"]
---

# Using Stable Diffusion with Core ML on Apple Silicon

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2022-12-01, 6 min read, How-to. Original: [https://huggingface.co/blog/diffusers-coreml](https://huggingface.co/blog/diffusers-coreml)

## Summary

Stable Diffusion can run on Apple Silicon via Core ML using Apple's ml-stable-diffusion repo, with pre-converted checkpoints for v1.4, v1.5, v2 base and v2.1 base hosted on the Hugging Face Hub. Each model comes in 'original' attention (CPU/GPU only, sometimes faster) or 'split\_einsum' attention (also runs on the Neural Engine), packaged either as ML Packages for Python or compiled mlmodelc bundles for Swift. The best result on an M1 Max was 18s per image, using original attention with all compute units on macOS Ventura 13.1, which is required to avoid black images. Step-by-step download and inference commands are given for Python and Swift, plus a pointer to Apple's conversion script for custom fine-tuned models.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Swift](https://swe.quest/tags/swift.md) (Languages)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Stable Diffusion basics
- Python package management ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

Core ML, Stable Diffusion, Apple Silicon, Neural Engine, Diffusers, Hugging Face Hub, split\_einsum

## Related posts

- [Swift 🧨Diffusers - Fast Stable Diffusion for Mac](https://swe.quest/articles/swift-diffusers-fast-stable-diffusion-for-mac-9aed97f099aa5274.md): Hugging Face · 2023-02-24 · Medium · 5 min read · Inference & serving, Performance engineering, Hardware, Swift, Machine learning
  Diffusers for Mac 1.1, an open-source SwiftUI app that runs Core ML-converted Stable Diffusion models locally, can generate images up to twice as fast as the previous version by automatically picking the best compute unit for each machine.
- [Faster Stable Diffusion with Core ML on iPhone, iPad, and Mac](https://swe.quest/articles/faster-stable-diffusion-with-core-ml-on-iphone-ipad-and-mac-5c3ad0b6711e28d5.md): Hugging Face · 2023-06-15 · Medium · 9 min read · Inference & serving, Mobile, Computer vision, Hardware
  Core ML in iOS 17 and macOS 14 adds 6-bit weight palettization for running Stable Diffusion faster and with less memory.
- [Stable Diffusion XL on Mac with Advanced Core ML Quantization](https://swe.quest/articles/stable-diffusion-xl-on-mac-with-advanced-core-ml-quantization-eb7e4e62c0405a93.md): Hugging Face · 2023-07-27 · Medium · 8 min read · Inference & serving, Computer vision, Mobile, Swift
  Stable Diffusion XL base has been ported to Core ML for Apple Silicon Macs (macOS 14 beta), with end-to-end latency ranging from 46 s on an M1 Max to 20 s on an M2 Ultra using CPU+GPU and the ORIGINAL attention implementation.
- [WWDC 24: Running Mistral 7B with Core ML](https://swe.quest/articles/wwdc-24-running-mistral-7b-with-core-ml-8ff5ba3b889a9bf2.md): Hugging Face · 2024-07-22 · Medium · 13 min read · Inference & serving, LLMs, Swift, Mobile
  Mistral 7B Instruct can run on a Mac with Core ML using features new in iOS 18 and macOS Sequoia: the MLTensor Swift type for tensor pre- and post-processing, stateful buffers that keep the kv-cache on the GPU instead of passing it in and out on every call, and block-wise 4-bit quantization.
- [Releasing Swift Transformers: Run On-Device LLMs in Apple Devices](https://swe.quest/articles/releasing-swift-transformers-run-on-device-llms-in-apple-devices-ee6106831bf892fd.md): Hugging Face · 2023-08-08 · Medium · 15 min read · Swift, Inference & serving, LLMs, Mobile
  Hugging Face released swift-transformers, an alpha Swift package with a transformers-like API for on-device text generation, along with the swift-chat demo app, updated exporters and transformers-to-coreml conversion tools, and pre-converted Llama 2 7B and Falcon 7B Core ML models.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
