Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

61–70 of 415 posts

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

#61
post #8

How fast is it on a m1?

It takes 1-2 mins for a 512x512 image. It's been a lot of fun since I did this last night.

For reference, inferencing the model on a 2070 takes 10-12 seconds for the same size at max-precision, and the 3070 can synthesize an image in almost 6 seconds.

If you extrapolate the power consumption (3070 @~300w vs M1 Pro GPU@~30-50w) the metrics make a lot of sense.

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

#62
post #45

Earlier quoted context omitted.

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

Weird, on M1 Max Mac Studio, only getting 1.42 it/s :/

I got my units backwards :sweat: My bad!

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

#64
post #52
post #45

Earlier quoted context omitted.

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

Depends what fork you're running... Some seem to be using CPU-based generation, others use the MPS device backend correctly which is MUCH faster. I have another comment floating around about lstein's fork, but it takes some massaging to get it to run happily. https://github.com/lstein/stable-diffusion/

The fork linked by OP is MPS-based, I can see GPU usage way up in Activity Monitor. Seems performance doubled after a reboot though :)

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

#67
post #15

Is there a good set of benchmarks available for Stable Diffusion? I was able to run a custom Stable Diffusion build on a GCE A100 instance (~$1/hour) at around 1Mpix per 10 seconds. I.e, I could create a 512x512 image in 2.5 seconds with some batching optimizations. A consumer GPU like a 3090 runs at ~1Mpix per 20 seconds. I'm wondering what the price floor of stock art will be when someone can use https://lexica.art…

So you’re estimating over a thousand generated images an hour and less than a tenth of a cent per image using the A100. If that turns out to be accurate, it seems like some online image generation will included in the price of the stock art.

(DreamStudio is charging a bit over one cent per generated image at default settings, depending on exchange rates.)

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

#68
Magnusviri[0], the original author of the SD M1 repo credited in this article, has merged his fork into the Lstein Stable Diffusion fork.

You can now run the Lstein fork[1] with M1 as of a few hours ago.

This adds a ton of functionality - GUI, Upscaling & Facial improvements, weighted subprompts etc.

This has been a big undertaking over the last few days, and I highly recommend checking it out. See the mac m1 readme [3]

[0] https://github.com/magnusviri/stable-diffusion

[1] https://github.com/lstein/stable-diffusion

[2] https://github.com/lstein/stable-diffusion/blob/main/README-...

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

#69
post #65
post #51

Hm, when I run the example, I get this error: > expected scalar type BFloat16 but found Float Has anyone seen this error? It's pretty hard to google for.

Are you running macOS >=12.3?

Oh, no I'm not, I'm on 12.0. Does this make a difference?

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

#70
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

When the model detects NSFW content it replaces the output with the frame of Rick Astley.

It's kind of amazing that ML can now intelligently rick roll people.

I think it would be awesome to update the rickroll feature to the following:

Auto Re-run the img2img with some text prompt: "all of the people are now Rick Astley" with low strength so it can adjust the faces, but not change the nudity!!!1

Post reply on HN