https://github.com/simonwhitaker/stable-diffusion-apple-silicon
A macOS app for running Stable Diffusion natively on Apple Silicon
https://github.com/simonwhitaker/stable-diffusion-apple-silicon
macos swift
Last synced: 8 months ago
JSON representation
A macOS app for running Stable Diffusion natively on Apple Silicon
- Host: GitHub
- URL: https://github.com/simonwhitaker/stable-diffusion-apple-silicon
- Owner: simonwhitaker
- Created: 2022-12-20T13:58:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-14T06:39:52.000Z (about 3 years ago)
- Last Synced: 2025-06-04T09:55:10.409Z (about 1 year ago)
- Topics: macos, swift
- Language: Swift
- Homepage:
- Size: 2.44 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stable Diffusion on Apple Silicon
This repo contains a simple app for running Stable Diffusion natively on macOS.

# Getting started
The app expects to be able to download models at startup from http://localhost:8080/models.aar. This means you need to acquire the models, compress them using Apple Archive, then host them locally. Here's how...
## Acquiring the models
Either follow the instructions [here](https://github.com/apple/ml-stable-diffusion#-using-ready-made-core-ml-models-from-hugging-face-hub) to use pre-built models from Hugging Face Hub, or the instructions [here](https://github.com/apple/ml-stable-diffusion#-using-ready-made-core-ml-models-from-hugging-face-hub) to build them yourself.
If building the models yourself, make sure to use the (slightly mis-named) `--bundle-resources-for-swift-cli` option, to output models in a format suitable for consumption by Swift. (The default is to output models suitable for consumption by Python).
Either way, you should end up with a folder with these contents:
- TextEncoder.mlmodelc
- Unet.mlmodelc
- VAEDecoder.mlmodelc
- merges.txt
- vocab.json
To build the .aar model archive, `cd` to that directory and run:
```command
rm -f models.aar && aa archive -d . -o models.aar
```
Now serve the models on localhost:8080 by running this command in the same directory:
```command
python3 -m http.server 8080
```