Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

121–130 of 415 posts

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

#122
How is Stable Diffusion on DreamStudio.ai so much faster than the reports here? Seems to only take 5-10 seconds to generate an image with the default settings.

I.e. How are they providing access to GPU compute several orders of magnitude more powerful than an M1, for free?

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

#123
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 suspect that the M2 air is thrashing the disk pretty aggressively. Diffusion models rerun the same model once per step, so for a generation with 50 steps, you copy the entire model in and out of memory 50 times. That's going to kill performance.

I believe the model is copied into ram once upon calling StableDiffusionPipeline, unless the mac implementation partially loads the model due to only having 8G of ram.

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

#124

Anyone know the largest possible image size > 512x512? I'm getting the following error when trying 1024x1024 with 64 GB RAM on M1 MAX: /opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appea…

just 512x require something like 10GB VRAM on your GPU, 1024x would need even more. How much VRAM does the M1 Max GPU have? You're probably running out of memory.

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

#125

How is Stable Diffusion on DreamStudio.ai so much faster than the reports here? Seems to only take 5-10 seconds to generate an image with the default settings. I.e. How are they providing access to GPU compute several orders of magnitude more powerful than an M1, for free?

A100 devices in the cloud on preemptive/spot instances?

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

#126

Anyone know the largest possible image size > 512x512? I'm getting the following error when trying 1024x1024 with 64 GB RAM on M1 MAX: /opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appea…

just 512x require something like 10GB VRAM on your GPU, 1024x would need even more. How much VRAM does the M1 Max GPU have? You're probably running out of memory.

M architecture is unified memory - so the system memory is shared as GPU memory. There is likely a cap somewhere on how much can be used by a single app (or collectively by all apps).

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

#127

How is Stable Diffusion on DreamStudio.ai so much faster than the reports here? Seems to only take 5-10 seconds to generate an image with the default settings. I.e. How are they providing access to GPU compute several orders of magnitude more powerful than an M1, for free?

1. Dreamstudio is paid, with 2 EUR worth of credit for free.

2. The M1 GPU is an iGPU. A good iGPU, sure, but it's not anywhere near the performance of a dedicated, cooled GPU with dedicated VRAM.

On a 2060 Super with 8 GB of VRAM and with tensor cores it takes 15 seconds to infer with the default settings. If Dreamstudio uses deep learning GPUs then there is your answer to why it is as fast.

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

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

For 512x512 on M1 MAX (32 core) with 64 GB RAM I'm getting 1.67it/s so 30.59s with the default ddim_steps=50.

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

#130

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

With the 1.4 checkpoint, everything under 40 steps can't be used basically and you only get good fidelity with >75 steps. I usually use 100, that's a good middleground.
Post reply on HN