Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

381–390 of 415 posts

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

#381

Earlier quoted context omitted.

Instructions don't work here, dead ends at FileNotFoundError: [Errno 2] No such file or directory: 'models/ldm/stable-diffusion-v1/model.ckpt' Looks like there's a step missing or broken at downloading the actual weights. Going up to the parent repo points at a bunch of dead links or hugginface pages.

You have to download the model from the huggingface[0] site first (requires a free account). The exact steps on how to link the file are then detailed here[1]. [0] https://huggingface.co/CompVis/stable-diffusion-v-1-4-origin... [1] https://github.com/lstein/stable-diffusion/blob/main/README-...

I did this but then moved the directory. When re-linking and checking with ls for the path I thought "oh, alright, it's already there". Oh well, better check with ls -l earlier next time.

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

#382

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

That worked thank you!

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

#384
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!

I just had to:

> brew link protobuf --overwrite

Don't blindly run this command unless you understand what you're doing.

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

#386

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.

Gods, yes. I've been trying to get various kinds of deepfake-related projects to work on M1 (or even just on Mac—the Intel Macs haven't come with Nvidia cards for years now) for some time now, as we're trying to generate video stimuli that present different people doing the same things, or the same person doing several different things, for psych research.

It's been an exercise in frustration.

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

#387
post #366

The various articles/tutorials seem a bit confusing: even though they say "M1", they also worked fine for me on an Intel Mac (and does end up using GPU). Does anyone know how to think about the --W --H and --f flags to create larger images? I have 64GB memory, but I get errors from PyTorch saying things like "Invalid buffer size: 7.54 GB" when I try to increase W and H, and I haven't managed to make the Python proces…

That must be using CUDA then, and you need a gpu with at least 8GB of VRAM, afaik (not RAM).

Ah-ha, thanks. My Intel Mac (2019) has https://www.techcenturion.com/intel-uhd-graphics-630

> Being an Integrated GPU, the Intel UHD Graphics 630 doesn’t have any Video/Graphics Memory of its own. Instead, it utilizes the system’s memory (RAM) dynamically for the same purpose. You can change the maximum Video Memory from the BIOS settings.

I get the impression Apple isn't going to give me much control over that (https://www.reddit.com/r/macmini/comments/e82knm/can_i_set_h...). I did have "Automatic Graphics Switching" enabled, but I'm seeing much the same with it off.

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

#388

Earlier quoted context omitted.

I was able not to have black images by using a different sampler --sampler k_euler full command: "photography of a cat on the moon" -s 20 -n 3 --sampler k_euler -W 384 -H 384

I tried that as well but resulted in an error: AttributeError: module 'torch._C' has no attribute '_cuda_resetPeakMemoryStats' https://gist.github.com/JAStanton/73673d249927588c93ee530d08...

hi jastanto. Im on an intel mac running into the same problem. Did you find a workaround?

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

#390
post #78

Thanks for this - it's rare to see a setup guide that actually works on each step! I did need to run the troubleshooting step too, could probably just move that up as a required step in the guide.

It isn't required for some (most?) users. Weirdly sometimes pip is picking up the wheel for `onnx`, sometimes it isn't, and we can't figure out why. Any Python packaging experts know what's going on? all macOS 12, arm64, Python 3.10. Can't think it wouldn't resolve the wheel. But yes, good idea to move up. I'll stick it next to the `pip install`.

Different versions of pip.
Post reply on HN