You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-4Lines changed: 31 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,30 +4,57 @@ Maple Diffusion runs Stable Diffusion models **locally** on macOS / iOS devices,
4
4
5
5

6
6
7
-
Maple Diffusion should be capable of generating a reasonable image in a minute or two on a recent iPhone (I get around ~2.3s / step on an iPhone 13 Pro).
7
+
Maple Diffusion should be capable of generating a reasonable image [in a minute or two](https://twitter.com/madebyollin/status/1579213789823893504) on a recent iPhone (I get around ~2.3s / step on an iPhone 13 Pro).
8
8
9
9
To attain usable performance without tripping over iOS's 4GB memory limit, Maple Diffusion relies internally on FP16 (NHWC) tensors, operator fusion from MPSGraph, and a truly pitiable degree of swapping models to device storage.
10
10
11
11
On macOS, Maple Diffusion uses slightly more memory (~6GB), to reach <1s / step.
12
12
13
13

14
14
15
+
# Projects using Maple Diffusion
16
+
17
+
*https://github.com/mortenjust/maple-diffusion/ is a fork with several improvements
18
+
19
+
# Device Requirements
20
+
21
+
Maple Diffusion should run on any Apple Silicon Mac (M1, M2, etc.). Intel macs seem to not support Float16 or something.
22
+
23
+
Maple Diffusion should run on any iOS device with [sufficient RAM](https://blakespot.com/ios_device_specifications_grid.html) (≥6144MB RAM definitely works; 4096MB *might* but I wouldn't bet on it; anything lower than that won't work). Recent iPads should work out of the box; recent iPhones should work if you can get the `Increase Memory Limit` capability working (to unlock 4GB of RAM).
24
+
25
+
iOS 16.1 (beta) is reportedly broken and always generating a gray image :(
26
+
15
27
# Usage
16
28
17
29
To build and run Maple Diffusion:
18
30
19
-
1. Download a Stable Diffusion model checkpoint ([`sd-v1-4.ckpt`](https://huggingface.co/CompVis/stable-diffusion-v1-4), or some derivation thereof)
31
+
1. Download a Stable Diffusion PyTorch model checkpoint ([`sd-v1-4.ckpt`](https://huggingface.co/CompVis/stable-diffusion-v1-4), or some derivation thereof)
4. Convert the PyTorch model checkpoint into a bunch of fp16 binary blobs.
28
51
29
52
```bash
30
53
./maple-convert.py ~/Downloads/sd-v1-4.ckpt
31
54
```
32
55
33
-
4. Open, build, and run the `maple-diffusion` Xcode project. You might need to set up code signing and stuff
56
+
5. Open the `maple-diffusion` Xcode project. Select the device you want to run on from the `Product > Destination` menu.
57
+
58
+
6.[Manually add](https://github.com/madebyollin/maple-diffusion/issues/5#issuecomment-1279111878) the `Increased Memory Limit` capability to the `maple-diffusion` target (this step might not be needed on iPads, but it's definitely needed on iPhones - the default limit is 3GB).
59
+
60
+
7. Build & run the project on your device with the `Product > Run` menu.
0 commit comments