Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

241–250 of 415 posts

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

#241
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?

On my M2 Air, 16G, 10 CPU cores, the default command as in the installing instructions takes like 2m20s.

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

#242
post #84

Earlier quoted context omitted.

Is that the difference in graphics performance between the M1 and M1 Pro or did the other person do something wrong? 70-90 minutes seems nuts

Might be the RAM difference. RAM is shared between CPU and GPU on the M1 series processors.

My 16gb M1 Air was initially taking 13 minutes for a 50 step generation. But when I closed all the open tabs and apps it went down to 3 minutes.

Looks like RAM drastically affects the speed.

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

#243
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…

I would assume it is the memory. The test command from the discussed link runs in slightly over 2 minutes on my M2 Air (16gb). How long does it take for yours?

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

#244
post #225

Earlier quoted context omitted.

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 cl…

The latter. The major frameworks, at least, can be run in CPU-only mode, with a hardware abstraction layer for other devices (like CUDA-capable cards, TPUs etc). So practically it means you need an Nvidia GPU to get anywhere in a reasonable amount of time, but if you're not super dependent on latency (for inference) then CPU is an option. In principle, CPUs can run much bigger model inputs (at the expense of even mor…

I was thinking (as someone who knows nothing about this really) that the Apple chips might be interesting because, while they obviously don't have the GPGPU grunt to compete with NVIDIA, they might have a more practical memory:compute ratio... depending on the application of course.

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

#245

How fast is it on a m1?

The answer depends VERY MUCH on RAM. My M1 with 8GB takes 70-90 minutes per image. My M1 Pro with 16GB takes 3 minutes per image.

Hopefully the library is intentionally going very slowly trying to fit in RAM and that's not just your 8GB machine totally falling over.

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

#246

Earlier quoted context omitted.

are there benchmarks? I was following the github issue and the CPU bound one was at 4-5 minutes, the MDS one was at 30 seconds, then 18 seconds, and people were still calling that slow. What is it currently at now? and I don't know what "fast" is, to compare What are the Windows 10 with nice Nvidia chips w/ CUDA getting? Just curious whats comprehensive

> What are the Windows 10 with nice Nvidia chips w/ CUDA getting? Are you referring to single iteration step times, or whole images? Because obviously it depends on the number of iteration steps used. Windows 10, RTX 2070 (laptop model), lstein repo. I get about 3.2 iter/sec. A 50 step 512x512 image takes me 15 seconds.

Huh, that’s the same speed I get on Collab. Pretty good.

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

#247

I keep running into issues, even after installing Rust in my condo environment (using conda). Specifically the issue seems to be building wheels for `tokenizers`: warning: build failed, waiting for other jobs to finish... error: build failed error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylib -C 'link-args=-…

I played around a bit and found out dropping the tokenisers version to 0.11.6 worked

`pip install tokenizers==0.11.6` first

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

#248
After playing around with all of these ML image generators I've found myself surprisingly disenchanted. The tech is extremely impressive but I think it's just human psychology that when you have an unlimited supply of something you tend to value each instance of it less.

Turns out I don't really want thousands of good images. I want a handful of excellent ones.

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

#249

Earlier quoted context omitted.

If you open up the script txt2img and img2img scripts, there is a content filter. If your prompt generated anything that gets detected as "inappropriate" the image is replaced with Rick Astley. Removing the censor should be pretty straightforward, just comment out those lines.

It bothers me that this isn't just configurable. Why would they not want to expose this as a feature?

Plausible deniability

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

#250

Earlier quoted context omitted.

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.

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.

Same here. My M1 Max's GPUs were basically idling until this came along!
Post reply on HN