Live data from Hacker News

Stable Diffusion with Core ML on Apple Silicon

machinelearning.apple.com

71–80 of 184 posts

Re: Stable Diffusion with Core ML on Apple Silicon

#71

Great stuff. I like that they give directions for both Swift and Python This gets you text descriptions to images. I have seen models that given a picture, then generate similar pictures. I want this because while I have many pictures of my grandmothers, I only have a couple of pictures of my grandfathers and it would be nice to generate a few more. Core ML is so well done. A year ago I wrote a book on Swift AI and u…

That’s DreamBooth. There are some services that will do it for you.

Thanks!

Re: Stable Diffusion with Core ML on Apple Silicon

#72

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.

What part of the SD license prohibits that?

Re: Stable Diffusion with Core ML on Apple Silicon

#73
post #10
post #9

How does this compare with using the Hugging Face `diffusers` package with MPS acceleration through PyTorch Nightly? I was under the impression that that used CoreML under the hood as well to convert the models so they ran on the Neural Engine.

It doesn't. MPS largely is on GPU. PyTorch's MPS implementation is incomplete a few weeks ago as well. This is about 3x faster.

Is it? I just ran it on my M1 MacBook Air and am getting 3 it/sec, same as I was using Stable Diffusion for M1. Maybe I'm doing something wrong?

Re: Stable Diffusion with Core ML on Apple Silicon

#74
post #21
post #7

Earlier quoted context omitted.

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

Video is really a series of frames, the framerate for film/human can get away with 24 frames/second-- so maybe ~40ms/image for real-time at least? What's cool about the era in which we live is if you look at high-performance graphics for games or simulations, for instance, it may in fact be faster to a the model to "enhance" a low-resolution frame rather than trying to render it fully on the machine. ex. AMD's FSR vs…

FSR 2.0 also uses temporal information and movement vectors to upscale, for what it's worth. DLSS 2.0 also renders at a lower resolution and upscales it. DLSS 3.0 frame generation is interesting, in that it holds "back" a frame and generates an extra one in between frame 1 and frame 2, allowing you to boost perceived frame rate massively, at the cost of some artifacting right now.

Re: Stable Diffusion with Core ML on Apple Silicon

#75
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?

They already do, with varying levels of performance and success.

See deforum[1] and andreasjansson‘s stable-diffusion-animation[2]

[1]: https://deforum.github.io/

[2]: https://replicate.com/andreasjansson/stable-diffusion-animat...

Re: Stable Diffusion with Core ML on Apple Silicon

#77
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

If you told me this was possible when I bought an M1 Pro less than a year ago, I wouldn’t believe you. This is insane.

Agreed.

And the posted benchmarks for the M2 Macbook Air make me consider 'upgrading' to an Air.

Re: Stable Diffusion with Core ML on Apple Silicon

#78

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.

All hail Grand Perspective back in the day, not sure who is carrying the "what's wasting my disk space" torch for free these days.

Edit: still alive! https://grandperspectiv.sourceforge.net/

Re: Stable Diffusion with Core ML on Apple Silicon

#80

Earlier quoted context omitted.

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.

What part of the SD license prohibits that?

No part of it.
Post reply on HN