Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

41–50 of 415 posts

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#41

Is there a way to get it to run on an an Intel-based Mac? I've attempted several times, but quickly ran into dependency issues and other quirks.

Comment from github: "By the way, i confirmed to work on my Intel 16-in MacBook Pro via mps. GPU (Radeon Pro 5500M 8GB) usage is 70-80% and It takes 3 min where --n_samples 1 --n_iter 1. My repo https://github.com/cruller0704/stable-diffusion-intel-mac"

For comparison, my RTX 2070 takes 10 seconds for one image (512x512)

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#42
post #36
post #35

Are we being pranked? I just followed the steps but the image output from my prompt is just a single frame of Rick Astley... EDIT: It was a false-positive (honest!) on the NSFW filter. To disable it, edit txt2img.py around line 325. Comment this line out: x_checked_image, has_nsfw_concept = check_safety(x_samples_ddim) And replace it with: x_checked_image = x_samples_ddim

That means the NSFW filter kicked in IIRC from reading the code. Change your prompt, or remove the filter from the code.

Haha, busted!

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#43
post #21

For those as keen as I am to try this out, I ran these steps, only to run into an error during the pip install phase: > ERROR: Failed building wheel for onnx I was able to resolve it by doing this: > brew install protobuf Then I ran pip install again, and it worked!

What kind of speed does this run at? Eg. How long to make a 512x512 image at standard settings?

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#44
post #11

Is there a way to get it to run on an an Intel-based Mac? I've attempted several times, but quickly ran into dependency issues and other quirks.

I believe the branch which adds support for Apple Silicon also adds support for running on Intel chips (albeit extremely slowly). I haven't tested it myself, but I've seen several people in the GitHub issues saying this.

The standard release works fine, if you tweak the code to use the CPU pytorch device instead of CUDA. It does take about an hour to generate a set of images with the standard options on my AMD 2600 CPU though!

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#45
post #22
post #12

could someone who has already done this please share how long it takes for a 50 steps image to be generated?

1.3 sec/iter on my M1 Mac, so ~39 seconds.

That was fast. I'm only getting 5.26s/iter on an M1 Pro MBP with 16GB RAM.

EDIT: Speed increased to 2.3s/iter after a reboot

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#47
post #42
post #36

Earlier quoted context omitted.

That means the NSFW filter kicked in IIRC from reading the code. Change your prompt, or remove the filter from the code.

Haha, busted!

To be fair, the reason the filter is there is that if you ask for a picture of a woman, stable diffusion is pretty likely to generate a naked one!

If you tweak the prompt to explicitly mention clothing, you should be OK though.

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#49
post #17

Note: I ran this and haven't yet been able to get img2img working yet. I borked it up trying to get conda working. It's been a lot of fun to play with so far though!

Apparently, this release should include a Dockerfile for easier replicability.

Unfortunately this can't run in Docker because Docker for Mac can't access the M1 GPU. (Several layers of virtualization and emulation!)
Post reply on HN