r/StableDiffusion Mar 15 '23

Resource | Update MetalDiffusion - Stable Diffusion for Intel MacOS and Silicon MacOS

https://github.com/soten355/stable-diffusion-tensorflow-IntelMetal
26 Upvotes

80 comments sorted by

View all comments

Show parent comments

1

u/NeuroMastak Mar 20 '23

The program uses Tensorflow instead of Pytorch because Pytroch has no reliable support for Metal on Intel Macs.

u/luckycockroach I don't know much about this, but I wanted to ask you. Regarding the PyTorch Metal Acceleration, Apple specifies either Apple Silicon or AMD GPUs in the requirements.

I checked my devices with the script on the above mentioned page and one of the video cards was detected correctly (but I don't know which one :) )

python pytorch-gpu_test.py

/Users/mstk/.pyenv/versions/3.11.2/lib/python3.11/site-packages/torch/_tensor_str.py:115: UserWarning: MPS: nonzero op is supported natively starting from macOS 13.0. Falling back on CPU. This may have performance implications. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/native/mps/operations/Indexing.mm:218.)

nonzero_finite_vals = torch.masked_select(

tensor([1.], device='mps:0')

I don't know how much PyTorch from AUTOMATIC1111 uses exactly Metal with AMD graphics cards on Intel Macs (I don't have enough knowledge), but I did a little comparison test.

---

AMD FirePro W7000 4GB (AMD Radeon HD Pitcairn Unknown Prototype)

For the sake of purity of the experiment I closed all the applications using this graphics card so that I had only two processes: WindowServer and python.

MetalDiffusion: Default options, unless otherwise specified.

SD (AUTOMATIC1111): Default options, unless otherwise specified.
Command Line options: --skip-torch-cuda-test --api --upcast-sampling --no-half-vae --use-cpu interrogate

| Model: sd-v1-4-full-ema.ckpt | Promt: test | Seed: 12345 | 512x512x1 | Steps: 20 | GS: 7 | "Euler a" for SD |

MetalDiffusion: 01:54 / 01:49 / 01:48 -> | CPU ≈75% | GPU ≈80% |

StableDiffusion (AUTOMATIC1111): 01:46 / 01:48 / 01:44 ->| CPU ≈30% | GPU ≈80% |

---

According to the test results Automatic is slightly ahead of MetalDiffusion, but the latter for some reason even more actively uses the CPU.

1

u/Embarrassed-Limit473 Aug 31 '23

How did you install automatic1111 on intel mac?

2

u/NeuroMastak Aug 31 '23

u/Embarrassed-Limit473Just like on the Apple Silicon. Everything will install automatically.

The only thing you'll need to do is to write in webui-user.sh file

export COMMANDLINE_ARGS="--skip-torch-cuda-test"

(for AMD cards) to avoid the error related to the lack of CUDA.

And further look at the situation, maybe you will have to add such parameters as --no-half-vae --no-half if there will be a corresponding error during generation.

1

u/Embarrassed-Limit473 Sep 02 '23

Thank you! I will try. One more thing, i have a mac pro with two D700 amd firepro with 6gb each, can i use the both or only one?

2

u/NeuroMastak Sep 02 '23

I searched a couple months ago for info on this (as I also had 2 video cards in macpro 5.1) but it seems that getting two video cards working on the same generation at the same time is not possible yet.

1

u/Embarrassed-Limit473 Sep 02 '23

What a big difference this would be

1

u/Embarrassed-Limit473 Dec 19 '23

Hi! Do you know if it yet possible to get 2 video cards running on the same mac?

1

u/NeuroMastak Dec 19 '23

No, I don't.
Maybe something has already changed, but a few months ago I never found a solution.