News for hackers. Stuff that matters.
Re:Run Stable Diffusion on Your M1 Mac’s GPU by amelius on Thursday September 01, 2022 @12:50PM (#32679211)
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?

Re:Run Stable Diffusion on Your M1 Mac’s GPU by nathas on Thursday September 01, 2022 @01:03PM (#32679472)
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 M1 forks.

Re:Run Stable Diffusion on Your M1 Mac’s GPU by davedx on Thursday September 01, 2022 @01:13PM (#32679633)
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 by cercatrova on Thursday September 01, 2022 @01:25PM (#32679829)
That's because CUDA is only for Nvidia GPUs and Apple doesn't support Nvidia GPUs, it has its own now.
Re:Run Stable Diffusion on Your M1 Mac’s GPU by desindol on Thursday September 01, 2022 @01:23PM (#32679798)
Didn’t apple stop supporting Nvidia cards like 5 years ago? How could it be confusing that Cuda wouldn’t run?
Re:Run Stable Diffusion on Your M1 Mac’s GPU by davedx on Saturday September 03, 2022 @08:14AM (#32701074)
Ah, I didn't realize. It's not very obvious what GPU you have in your Macbook, I couldn't actually find out where to find that in my System settings. On Windows it's inside the "Display" settings but on MacOS... where is it? :)
Re:Run Stable Diffusion on Your M1 Mac’s GPU by root_axis on Thursday September 01, 2022 @02:00PM (#32680436)
lol presumably the OP didn't know that... hence the confusion.
Re:Run Stable Diffusion on Your M1 Mac’s GPU by dustingetz on Thursday September 01, 2022 @02:17PM (#32680683)

    (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 by calrizien on Thursday September 01, 2022 @06:02PM (#32683925)
link?
Re:Run Stable Diffusion on Your M1 Mac’s GPU by scoopertrooper on Thursday September 01, 2022 @01:07PM (#32679543)
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 by bfirsh on Thursday September 01, 2022 @08:08PM (#32685038)
As mentioned in sibling comments, Torch is indeed the glue in this implementation. Other glues are TVM[0] and ONNX[1]

These just cover the neural net though, and there is lots of surrounding code and pre-/post-processing that isn't covered by these systems.

For models on Replicate, we use Docker, packaged with Cog for this stuff.[2] Unfortunately Docker doesn't run natively on Mac, so if we want to use the Mac's GPU, we can't use Docker.

I wish there was a good container system for Mac. Even better if it were something that spanned both Mac and Linux. (Not as far-fetched as it seems... I used to work at Docker and spent a bit of time looking into this...)

[0] https://tvm.apache.org/ [1] https://onnx.ai/ [2] https://github.com/replicate/cog