Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

181–190 of 415 posts

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

#181
post #171
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.

Update: I solved this error more properly by upgrading to the latest version. Thanks bfirsh.

I am having the same issue on MacOS 12.2.1 (21D62); Python 3.10.6 What did you upgrade to solve this? Thanks! (I can get it working with `--precision full`)

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

#182
post #142
post #90

Earlier quoted context omitted.

Nice. We'll get this guide updated for this fork. Everything's moving so fast it's hard to keep track! We struggled to get Conda working reliably for people, which it looks like lstein's fork recommends. I'll see if we can get it working with plain pip.

Running lstein's fork with these requirements[0] but seeing this output[1]. Same steps as original guide otherwise. Anyone got any ideas? [0] https://github.com/bfirsh/stable-diffusion/blob/392cda328a69... [1] https://gist.github.com/bfirsh/594c50fd9b2e6b173e31de753a842...

Same output for me also.

EDIT: https://github.com/lstein/stable-diffusion/issues/293#issuec... fixed it for me.

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

#183
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.

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

#184
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.

[deleted]

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

#185

It's insane to me how fast this is moving. I jumped through a bunch of hoops 2-3 days ago to get this running on my M1 Mac's GPU and now it's way easier. I imagine we will have a nice GUI (I'm aware of the web-ui, I haven't set it up yet) packaged in an mac .app by the end of next week. Really cool stuff.

Just yesterday I read another comment on HN saying we will have to wait another decade before being able train it in someone "basement"( https://news.ycombinator.com/item?id=32658941 ). I made a bookmark for myself ( https://datum.alwaysdata.net/?explorer_view=quest&quest_id=q... ) to look for data that help estimate when it will be feasible to run Stable Diffusion "at home". I guess it's already outdated!

To run stable diffusion at home you have to download the model file, which took the equivalent of tens of thousands of hours spread across cloud provided GPUs.

If the model file just vanished from everyone's hard drive one day, and cloud providers installed heuristics to detect and ban image dataset training, retraining the model file would actually take decades for any consumer, even an enthusiast with a dozen powerful GPUs. The image dataset alone is 240TB.

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

#186

It's insane to me how fast this is moving. I jumped through a bunch of hoops 2-3 days ago to get this running on my M1 Mac's GPU and now it's way easier. I imagine we will have a nice GUI (I'm aware of the web-ui, I haven't set it up yet) packaged in an mac .app by the end of next week. Really cool stuff.

I hope this kickstarts some kind of M1 migration. There are so many ML projects I'd like to try, but they all depend on CUDA.

Do they depend on CUDA, or are they just much better tuned for NVIDIA cards? I thought the whole ML ecosystem was based on training models and then running them on frameworks, where model was sorta like data and the framework handles the hardware? (albeit with models that can be tweaked to run more efficiently on different hardware) (I don't really know the ecosystem so it is definitely possible that they are more closely tied together than I thought).

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

#187

Earlier quoted context omitted.

img2img runs in 6 seconds on my GeForce 3080 12 GB. 6+ it\s depending on how much GPU memory is available. If I have any electron apps running it slows down dramatically.

Curious about: 1. Image size 2. Steps 3. What your numbers are for text2img 4. (most importantly) are you including the 30 seconds or so it takes to load the model initially? i.e. if you were to run 10 prompts and then divide the total time by 10, what are your numbers?

Re 4 the lstein repo gives you an interactive repl, so you don't have to reload the model on every prompt.

I also have a 3080 and as far as I remember (not at my pc right now) it was 3-10 secs for img2img 512px cfg13 50 steps batch size 1 dimm sampler.

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

#188

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.

Runs on my 2070S at 12s/image (no batch optimization) and on my GTX1050 4GB at 90s/image

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

#189
post #180

Running into this error `RuntimeError: expected scalar type BFloat16 but found Float` when I run `txt2img.py`

Confirming I'm stuck on the same error when running the tutorial-instructed python scripts/txt2img.py command RuntimeError: expected scalar type BFloat16 but found Float

Yes, me too! Please post here if you find a solution for all the other people that come and find this by commmand-F'ing this error

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

#190

Earlier quoted context omitted.

Yep, I was just thinking the same thing. M1/M2 appears to be a huge untapped resource for ML stuff as this proves. I maxed out my MBP Max and this is probably the first time I'm actually fully using the GPU cores and it's pretty freaking cool. Creating landscapes or fictional characters (think D&D) is already super fun, I look forward to playing with img2img some more as well.

The performance gap to the top-end Nvidia cards will get much larger as they release new cards later this year, though.

Maybe, but I can buy a Mac, you just order one from Apple.
Post reply on HN