Live data from Hacker News

Stable Diffusion with Core ML on Apple Silicon

machinelearning.apple.com

21–30 of 184 posts

Re: Stable Diffusion with Core ML on Apple Silicon

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

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 NVIDIA DLSS

- AMD FSR (Fidelity FX Super Resolution): https://www.amd.com/en/technologies/fidelityfx-super-resolut...

- NVIDIA DLSS (Deep Learning Super Sampling): jhttps://www.nvidia.com/en-us/geforce/technologies/dlss/

AMD's approach renders the game at a crummy, low-detail resolution then each frame uses "upscales"

Both FSR and DLSS aim to improve frames-per-second in games by rendering them below your monitor’s native resolution, then upscaling them to make up the difference in sharpness. Currently, FSR uses spatial upscaling, meaning it only applies its upscaling algorithm to one frame at a time. Temporal upscalers, like DLSS, can compare multiple frames at once, to reconstruct a more finely-detailed image that both more closely resembles native res and can better handle motion. DLSS specifically uses the machine learning capabilities of GeForce RTX graphics cards to process all that data in (more or less) real time.

Video is really a series of frames, the framerate for film/human could get away with 24 frames/second-- ~40ms/image for real-time.

What's cool about the era in which we live is if you look at high-performance graphics for games or simulations, it may in fact be faster to run the model on each frame to "enhance" a low-resolution frame rather than trying to render it fully on the machine.

ex. AMD's FSR vs NVIDIA DLSS

- AMD FSR (Fidelity FX Super Resolution): https://www.amd.com/en/technologies/fidelityfx-super-resolut...

- NVIDIA DLSS (Deep Learning Super Sampling): https://www.nvidia.com/en-us/geforce/technologies/dlss/

AMD's approach renders the game at a crummy, low-detail resolution then use "spatial upscaling" to enhance the images one frame at a time.

NVIDIA DLSS uses "temporal upscaling" to pass over multiple frames and uses other capabilities exclusive to Nvidia's cards to stitch together the frames.

This is a different challenge than generating the content from scratch

I don't think this is possible in real-time yet, but someone put a filter trained on the German country side to produce photorealistic Grand Theft Auto driving gameplay:

https://www.youtube.com/watch?v=P1IcaBn3ej0

Notice the mountains in the background go from Southern California brown to lush green

https://www.rockpapershotgun.com/amd-fsr-20-is-a-more-demand....

Re: Stable Diffusion with Core ML on Apple Silicon

#23
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 used Core ML in several examples.

Re: Stable Diffusion with Core ML on Apple Silicon

#24
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.

I could be wrong but I think part of the issue is this needs some large files for the trained dataset?

Re: Stable Diffusion with Core ML on Apple Silicon

#26

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?

Works offline, privacy, independent of SaaS (API stability, longevity, …). I'm sure there are more.

Re: Stable Diffusion with Core ML on Apple Silicon

#27

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?

Powerful servers with GPUs are expensive. Laptops you already own, aren't.

Re: Stable Diffusion with Core ML on Apple Silicon

#28
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.

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

https://diffusionbee.com

Re: Stable Diffusion with Core ML on Apple Silicon

#29

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?

> There are a number of reasons why on-device deployment of Stable Diffusion in an app is preferable to a server-based approach. First, the privacy of the end user is protected because any data the user provided as input to the model stays on the user's device. Second, after initial download, users don’t require an internet connection to use the model. Finally, locally deploying this model enables developers to reduce or eliminate their server-related costs.

Re: Stable Diffusion with Core ML on Apple Silicon

#30
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.

Where are you seeing the installation process?
Post reply on HN