Live data from Hacker News

Stable Diffusion with Core ML on Apple Silicon

machinelearning.apple.com

61–70 of 184 posts

Re: Stable Diffusion with Core ML on Apple Silicon

#61
post #49

Earlier quoted context omitted.

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.

I have Macbook Air M1, which is passively cooled. When cooled properly, that is thermal pad mod combined with a fan under the laptop, I'm getting closer to 2min - something like 2.8s per iteration. I guess it would be something 140s for 50 iterations on a MacBook Pro or Mac mini for M1.

This is accurate re: M1 Mac Mini times IME

Re: Stable Diffusion with Core ML on Apple Silicon

#62
post #3

https://github.com/apple/ml-stable-diffusion

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

Let's give it a few days and someone will have something semi-automatic ready

Re: Stable Diffusion with Core ML on Apple Silicon

#64

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?

Soon you will be able to render home imovies like they were edited by the team that made the dark knight (which costs ~$100k/min if done professionally).

"A long time ago in a galaxy far, far away"

but seriously, I wonder when you'll be able to paste in a script, and get out a storyboard or a movie

Re: Stable Diffusion with Core ML on Apple Silicon

#67
post #7
post #2

Atila from Apple on the expected performance: > For distilled StableDiffusion 2 which requires 1 to 4 iterations instead of 50, the same M2 device should generate an image in https://twitter.com/atiorh/status/1598399408160342039

i'm very ignorant here so forgive me but if it can generate images that fast can it be used to generate a video?

[deleted]

Re: Stable Diffusion with Core ML on Apple Silicon

#68

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?

That's done in professional contexts, when you only care about inference onnxruntime does the job well (including for coreml [1]).

I imagine that here apple wants to highlight a more research/interactive use, for example to allow fine tuning SD on a few samples from a particular domain (a popular customization).

[1] https://onnxruntime.ai/docs/execution-providers/CoreML-Execu...

Re: Stable Diffusion with Core ML on Apple Silicon

#69

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?

Apple has their own mlmodel format but they can’t distribute this model as a direct download due to the models EULA. The first task is to translate the model.

Re: Stable Diffusion with Core ML on Apple Silicon

#70

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…

Conda's actually a pretty well respected python distribution package manager from Anaconda.com (see e.g. https://en.wikipedia.org/wiki/Anaconda_(Python_distribution)). Anaconda has a lot of the standard scientific python computing packages in addition to a virtual environment and package manager or you could use Miniconda version for just the conda package manager + virtualenv.

I think whether you need a virtualenv depends on your system python version and compatibility of any of the dependencies, but it's also pretty nice to be able to spin up or blow away envs without bloating your main python directory or worrying that you're overwriting dependencies for a different project.

Post reply on HN