Live data from Hacker News

Stable Diffusion with Core ML on Apple Silicon

machinelearning.apple.com

51–60 of 184 posts

Re: Stable Diffusion with Core ML on Apple Silicon

#51

This may sound naive, but what are some use cases of running SD models locally? If the free/cheap options exist (like running SD on powerful servers), then what's the advantage of this new method?

fine tuned custom models, models with IP knowledge, models that know what you look like. Better latency etc etc. Obviously some can be served by models hosted locally. You can host a model with Triton and create an API to call it in your native application.

Re: Stable Diffusion with Core ML on Apple Silicon

#52
post #36

Earlier quoted context omitted.

> Oh gosh that's an intimidating installation process I'm not seeing any installation instructions on either link - what am I missing?

All I had to do was: - create a virtual environment (Python 3.8.15 worked best) - upgrade pip - pip install wheel - pip install -r requirements.txt - and then, python setup.py install - Had to update my XCode to use the generated mlpackage files :/ - Expand drawer with instructions and follow them to download model and convert it to Core ML format - Run their CLI command as mentioned

Where did you get those instructions from? Is creating a virtual environment necessary if I'm fine with it running on my real system?

I assume the environment part is what the "conda" commands on the GitHub repo readme are doing, but finding "conda" to install seems to be its own process. It's not on MacPorts, pip seems to only install a Python package instead of an executable, and getting a package from some other site feels sketchy.

What is it with ML and Python, anyway? Why is this amazing new technology being shrouded in an ecosystem and language which… well, I guess if I can't say anything nice…

Re: Stable Diffusion with Core ML on Apple Silicon

#53
post #14

Earlier quoted context omitted.

With the full 50 iterations it appears to be about 30s on M1. They have some benchmarks on the github repo: https://github.com/apple/ml-stable-diffusion For reference, previously I was getting about <3 minutes for 50 iterations on my Macbook Air M1. I haven't yet tried Apple's implementation but it looks like a huge improvement. It might take it from "possible" to "usable".

For comparison, it's also taking ~3min @ 50 iterations on my 12c Threadripper using OpenVino. It sounds like the improvements bring the M1 performance roughly in line with a GTX 1080.

Not SD2.0 but SD1.5, I am getting 30 iterations in 10 seconds on 1080ti. 50 iterations 18 seconds. 100%|| 30/30 [00:10<00:00, 2.84it/s]

Re: Stable Diffusion with Core ML on Apple Silicon

#54

Earlier quoted context omitted.

Oh gosh that's an intimidating installation process. I'll be much more interested when I can just `brew install` a binary.

A bit different take is DiffusionBee, if you're curious to try it out in a GUI form. https://diffusionbee.com

On the one hand, I appreciate the attempt to bring this stuff into the realm of "double click to run" boneheads like me, but on the other hand, I really despise Electron apps when they're multi-platform, where such use is somewhat understandable if still despicable. For a Mac-only app to use Electron… Why do they hate us so?

Re: Stable Diffusion with Core ML on Apple Silicon

#55
How come you always have to install some version of pytorch or tensor flow to run these ml models? When I'm only doing inference shouldn't there be easier ways of doing that, with automatic hardware selection etc. Why aren't models distributed in a standard format like onnx, and inference on different platforms solved once per platform?

Re: Stable Diffusion with Core ML on Apple Silicon

#56

Earlier quoted context omitted.

A bit different take is DiffusionBee, if you're curious to try it out in a GUI form. https://diffusionbee.com

On the one hand, I appreciate the attempt to bring this stuff into the realm of "double click to run" boneheads like me, but on the other hand, I really despise Electron apps when they're multi-platform, where such use is somewhat understandable if still despicable. For a Mac-only app to use Electron… Why do they hate us so?

I'm baffled by continued hate on Electron. The option isn't between Electron and a lean OS-native application, but between Electron and nothing.

I can build an Electron app in under a day with a pretty UI. It would take me several months to get anything sensible that is OS native. And I'm not going to sit down and learn the alternative.

So please just say "thank you" to the developers that are sharing free things with you.

Re: Stable Diffusion with Core ML on Apple Silicon

#57

Earlier quoted context omitted.

All I had to do was: - create a virtual environment (Python 3.8.15 worked best) - upgrade pip - pip install wheel - pip install -r requirements.txt - and then, python setup.py install - Had to update my XCode to use the generated mlpackage files :/ - Expand drawer with instructions and follow them to download model and convert it to Core ML format - Run their CLI command as mentioned

Where did you get those instructions from? Is creating a virtual environment necessary if I'm fine with it running on my real system? I assume the environment part is what the "conda" commands on the GitHub repo readme are doing, but finding "conda" to install seems to be its own process. It's not on MacPorts, pip seems to only install a Python package instead of an executable, and getting a package from some other s…

+1

Re: Stable Diffusion with Core ML on Apple Silicon

#58

Earlier quoted context omitted.

All I had to do was: - create a virtual environment (Python 3.8.15 worked best) - upgrade pip - pip install wheel - pip install -r requirements.txt - and then, python setup.py install - Had to update my XCode to use the generated mlpackage files :/ - Expand drawer with instructions and follow them to download model and convert it to Core ML format - Run their CLI command as mentioned

Where did you get those instructions from? Is creating a virtual environment necessary if I'm fine with it running on my real system? I assume the environment part is what the "conda" commands on the GitHub repo readme are doing, but finding "conda" to install seems to be its own process. It's not on MacPorts, pip seems to only install a Python package instead of an executable, and getting a package from some other s…

They are basically conventions for Python but the actual instructions I just found are unexpanded in the README on the GitHub repo. You have to run one of the commands which downloads the model and converts it for you to Core ML. If you've never used Hugging Face, you'll need to create an account to get a token and then use their CLI to login with the token to be able to download the model. Then you can run prompts from CLI with the commands they give.

Re: Stable Diffusion with Core ML on Apple Silicon

#60

Man, this takes a ton of room to do the CoreML conversions - ran out of space doing the unet conversion even though I started with 25GB free. Going on a delete spree to get it up to 50GB free before trying again.

How much space do you have and how much do you try to keep free? I get freaked out if I have less than 400gb free.

    /dev/disk3s5  926Gi  857Gi   52Gi    95% 8067489 540828800    1%   /System/Volumes/Data
It normally hovers around 30-35Gi free.
Post reply on HN