Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

91–100 of 415 posts

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

#91
post #83

Earlier quoted context omitted.

I've tried using this set of steps [1], but have so far not had luck, mostly because the ROCm driver setup is throwing me for a loop. Tried it with an RX 6700 XT and first was going to test on Ubuntu 22.04 but realized ROCm doesn't support that OS yet, so tried again on 20.04 and ended up breaking my GPU driver! [1] https://gist.github.com/geerlingguy/ff3c3cbcf4416be2c0c1e0f8...

Yes. That's expected. AMD market segmented their RDNA2 support in ROCm to the Navi21 set only (6800/6800 XT/6900 XT). It is not officially supported in any way on other RDNA2 GPUs. (Or even on the desktop RDNA2 range at all, that only works because their top end Pro cards share the same die)

As an aside, a totally unsupported hack to make it somewhat work on Navi2x smaller dies which you use:

HSA_OVERRIDE_GFX_VERSION=10.3.0 to force using the Navi21 binary slice.

This is totally unsupported and please don't complain if something doesn't work when using that trick.

But basic PyTorch use works using this, so you might get away with it for this scenario.

(TL;DR: AMD just doesn't care about GPGPU on the mainstream, better to switch to another GPU vendor that does next time...)

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

#93

This should be put into a docket image to avoid various potential conflicts with locally installed libraries. Anyone do this for the M1?

Unfortunately this can't run in Docker because Docker for Mac can't access the M1 GPU. (Several layers of virtualization and emulation!)

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

#94

Earlier quoted context omitted.

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

I haven't installed from this link specifically, but I used one of the branches on which this is based a few days ago, so the results should be similar. On a first-gen M1 Mac mini with 8GB RAM, it takes 70-90 minutes for each image. Still feels like magic, but old-school magic.

Installed from this link on a MacBook Pro (16-inch, 2021) with Apple M1 Pro and 16GB. First run downloads stuff, so I omit that result.

I had a YouTube video playing while I kicked off the exact command in the install docs, and got: 16.84s user 99.43s system 61% cpu 3:08.51 total

Next attempt, python aborted 78 seconds in! Weird.

Next attempt, with YouTube paused: 16.31s user 95.48s system 65% cpu 2:49.45 total

So around three minutes, I'd say.

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

#96
post #90

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…

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.

Check my comment alongside yours, I got Conda to work but it did require the pre-requisite Homebrew packages you originally recommended before it would cooperate :)

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

#97
post #28
post #16

Earlier quoted context omitted.

Broadly speaking, it looks like they are. The implementation of Stable Diffusion doesn't appear to be using all of those features correctly (i.e. device selection fails if you don't have CUDA enabled even though MPS ( https://pytorch.org/docs/stable/notes/mps.html ) is supported by PyTorch. Similar goes for quirks of Tensorflow that weren't taken advantage of. That's largely the work that is on-going in the OSX and M…

I got stuck on this roadblock, couldn’t get CUDA to work on my Mac, was very confusing

    (base)   stable-diffusion git:(main) conda env create -f environment.yaml
    Collecting package metadata (repodata.json): done
    Solving environment: failed
    
    ResolvePackageNotFound:
      - cudatoolkit=11.3
oh i was following the github fork readme, there is a special macos blog post

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

#98
Is there anyway to keep up with this stuff / beginners guide? I really want to play around with it but it's kinda confusing to me.

I don't have an M1 Mac, I have an Intel one with an AMD GPU, not sure if i can run it? don't mind if it's a bit slow, or what is the best way of running it in the cloud? Anything that can product high res for free?

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

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

Post reply on HN