News for hackers. Stuff that matters.
Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by gbighin on Thursday November 24, 2022 @09:02AM (#33731350)
Oh, interesting! But does it support CUDA? How is the integrated GPU used for ML tasks?
Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by pavlov on Thursday November 24, 2022 @09:36AM (#33731703)
I believe there’s a Tensorflow acceleration adapter for Apple’s ML API which uses Metal behind the scenes.
Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by Filligree on Thursday November 24, 2022 @09:06AM (#33731376)
It does not support CUDA; SD does not require CUDA.
Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by hnarayanan on Thursday November 24, 2022 @09:45AM (#33731823)
Both PyTorch and TensorFlow offer backends for Metal that works pretty well on Apple Silicon.
Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by dagmx on Thursday November 24, 2022 @11:34AM (#33733225)
To add to what people said, most of these ML models target an ML library like TensorFlow or PyTorch.

Those in turn have hardware accelerated backends. Traditionally they’ve only had CUDA backends but Apple ported large chunks of both to Metal as well.

So none of these libraries really target CUDA. In fact they’d run fine without a supported GPU but much slower.

Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by malshe on Thursday November 24, 2022 @01:10PM (#33734432)
pytorch can use the GPUs on M1 macs. Sebastian Raschka's post explains it nicely and shows some benchmarks too. https://sebastianraschka.com/blog/2022/pytorch-m1-gpu.html

From his post:

  if you want to run PyTorch code on the GPU, use torch.device("mps") analogous to torch.device("cuda") on an Nvidia GPU.
Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by crucialfelix on Thursday November 24, 2022 @01:45PM (#33734869)
In some cases there are operations not supported on mps. For those set:

os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"

and it will run on cpu if some operation isn't supported

Re:Stable Diffusion 2.0 on Mac and Linux via imaginAIry Pyth... by malshe on Thursday November 24, 2022 @03:37PM (#33735952)
Excellent! Thanks