Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

331–340 of 415 posts

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

#331
post #165
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…

It can be even cheaper. Midjourney, in case you appreciate their output, has an unlimited plan for 30$ a month. The only limitation is that if you're an extremely heavy user, they may "relax" you, which means results come in a bit slower. Note that they've been also experimenting with a --beta parameter which basically means the algorithm uses StableDiffusion's algorithm behind the scenes, or you can use any of 4 ver…

>The only limitation is that if you're an extremely heavy user, they may "relax" you, which means results come in a bit slower.

You don't have to be an extremely heavy user. I used it for about an hour every evening and it took 11 days out of a month subscription for them to put me on relax mode.

The relax mode is based on how busy the service is. If usage is low, it's the same a fast mode. But other times its really slow.

That makes it unpredictable enough that it stopped being fun for me to use it. I've barely used midjourney since I got put on relaxed mode - it stopped feeling like I can jump on and play because I might hit a busy period and then it'll take 5 minutes to generate a prompt

That said, I could buy more hours of fast mode and I think it's still way cheaper than Dall-E or Dreamstudio

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

#332

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…

Cool

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

#333

Everyone posting their pip/build/runtime errors is everything that's wrong with tooling built on top of python and its ecosystem. It would be nice to see the ML community move on to something that's actually easily reproducible and buildable without "oh install this version of conda", "run pip install for this package", "edit this line in this python script".

It's not just the python, this is the experience practically everywhere and that's why people create containers etc. It's excruciatingly hard to setup the environment to start doing anything productive these days, you can't just start coding unless you use an IDE like Xcode or PyCharm.

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

#334

How long does it take to generate a single image? Is it in the 30 min type range or a few mins? It's hypothetically "possible" to run e.g. OPT175B on a consumer GPU via Huggingface Accelerate, but in practice it takes like 30 mins to generate a single token.

About 10 secs per image on M1 Max with the right noise schedule and sampler. https://twitter.com/Birchlabs/status/1565029734865584143?s=2...

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

#335
post #103

The difference between an M2 air (8gb/512gb) versus an M1 pro (16gb/1tb) is much more than I expected. * M1 pro (16gb/1tb) can run the model in around 3 minutes. * M2 air (8gb/512gb) takes ~60 minutes for the same model. I knew there would be some throttling due to the m2 air's fanless model, but I had no idea it would be a 20x difference (albeit, the m1 pro does have double the RAM. I don't have any other macbooks t…

Neither of these should take minutes. Try Heun sampler, 8 steps, Karras noise schedule. Should be possible to get good images in 11 secs (or 10 secs if you go down to 7 steps). measurements admittedly from M1 Max. https://twitter.com/Birchlabs/status/1565029734865584143?s=2...

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

#337
post #99

Without k-diffusion support, I don't think this replicates Stable Diffusion experience: https://github.com/crowsonkb/k-diffusion Yes, running on M1/M2 (MPS device) was possible with modifications. img2img and inpainting also works. However you'll run into problems when you want k-diffusion sampling or textual inversion support.

stable-diffusion supports k-diffusion just fine on M1. You just have to detach a tensor in to_d() to stop the values exploding to infinity. https://twitter.com/Birchlabs/status/1563622002581184517?s=2...

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

#338

Earlier quoted context omitted.

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

Getting around 4 minutes per image on M1 MacBook Air 16GB

Hm, taking 2 hours on my M1 MacBook Air 16GB and it's clearly swapping. Are you using model v1.4? Or any other memory optimization that you applied?

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

#339

Everyone posting their pip/build/runtime errors is everything that's wrong with tooling built on top of python and its ecosystem. It would be nice to see the ML community move on to something that's actually easily reproducible and buildable without "oh install this version of conda", "run pip install for this package", "edit this line in this python script".

I disagree, dependencies are sort of a universal problem. Ever had to set LD_LIBRARY_PATH? Python is pretty much innocent here.

> Python is pretty much innocent here.

Could not possibly disagree more. https://xkcd.com/1987/

The problem with dependencies is that for very bad reasons people don’t ship them.

Someone needs to package SD with a full copy of the Python runtime and every dependency. This should be the default method of distribution.

#ShipYourDamnDependencies

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

#340
post #298

For me: File "/Users/layer/src/stable-diffusion/venv/lib/python3.10/site-packages/torch/serialization.py", line 250, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'models/ldm/stable-diffusion-v1/model.ckpt' The directory is empty. Hmm. I forgot to mv sd-v1-4.ckpt models/ldm/stable-diffusion-v1/model.ckpt On a Mac Studio data: 100%|| 1/1 [00:43

[deleted]
Post reply on HN