Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

21–30 of 415 posts

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

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

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

#23
Thanks for writing this up!! I enjoyed getting TensorFlow running with the M1, although a multi-headed model I was working on wouldn’t run.

I just made my Dad’s 101 year old birthday card using OpenAI’s image generating service (he loved it) and when I get home from travel I will use your instructions in the linked article.

Any advice for running Stable Diffusion locally vs. Colab Pro or Pro+? My M1 MacBook Pro only has 8G ram (I didn’t want to wait a month for a 16G model). Is that enough? I have a 1080 with 10G graphics memory. Is that sufficient?

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

#24
post #4

I'd rather see someone implemented glue that allows you to run arbitrary (deep learning) code on any platform. I mean, are we going to see X on M1 Mac, for any X now in the future? Also, weren't torch and tensorflow supposed to be this glue?

If you look at the substance of the changes being made to support Apple Silicon, they're essentially detecting an M* mac and switching to PyTorch's Metal backend.

So, yeah PyTorch is correctly serving as a 'glue'.

https://github.com/CompVis/stable-diffusion/commit/0763d366e...

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

#25
post #14

One beautiful thing I realized about all this progress in AI. We will still need people to do the hard yards, and get dirt between their fingernails. I am firmly in the camp of those people. Fancy algorithms won't dig holes, or lay out rail tracks of over hundreds of miles.. or build houses all across the world.

Are you following progress in robotics?

School us! What’s the latest in robotics that is going to knock our socks off?

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

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

In the troubleshooting section it mentions running:

    brew install Cmake protobuf rust
To fix onnx build errors. I had the same issue.

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

#27
post #14

Earlier quoted context omitted.

Are you following progress in robotics?

School us! What’s the latest in robotics that is going to knock our socks off?

They've got death robots that can fly now.

Why is nobody impressed by the future?

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

#28
post #16
post #4

I'd rather see someone implemented glue that allows you to run arbitrary (deep learning) code on any platform. I mean, are we going to see X on M1 Mac, for any X now in the future? Also, weren't torch and tensorflow supposed to be this glue?

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

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

#29

Note: I ran this and haven't yet been able to get img2img working yet. I borked it up trying to get conda working. It's been a lot of fun to play with so far though!

Yesterday I thought I broke it too. In my case, the solution was just to make sure that the input image (from the editor or otherwise) was the same size as the output image. Hope it helps.

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

#30
I've been playing with Stable Diffusion a lot the past few days on a Dell R620 CPU (24 cores, 96 GB of RAM). With a little fiddling (not knowing any python or anything about machine learning) I was able to get img2img.py working by simply comparing that script to the txt2img.py CPU patch. Was only a few lines of tweaking. img2img takes ~2 minutes to generate an image with 1 sample and 50 iterations, txt2img takes about 10 minutes for 1 sample and 50 generations.

The real bummer is that I can only get ddim and plms to run using a CPU. All of the other diffusions crash and burn. ddim and plms don't seem to do a great job of converging for hyper-realistic scenes involving humans. I've seen other algorithms "shape up" after 10 or so iterations from explorations people do online - where increasing the step count just gives you a higher fidelity and/or more realistic image. With ddim/plms on a CPU, every step seems to give me a wildly different image. You wouldn't know that steps 10 and steps 15 came from the same seed/sample they change so much.

I'm not sure if this is just because I'm running it on a CPU or if ddim and plms are just inferior to the other diffusion models - but I've mostly given up on generating anything worthwhile until I can get my hands on an nvida GPU and experiment more with faster turn arounds.

Post reply on HN