Live data from Hacker News

OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

github.com

41–50 of 88 posts

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#41
post #40

Earlier quoted context omitted.

But honest question, if this is your goal, why not use a GAN instead? You should still be able to produce high quality images but at a much faster rate (I'd guess around 10 minutes?). Sure, you'll have a bit lower diversity and maybe not SOTA quality image generation, but neither is this thing. Or you could reduce quality. This reddit user seems to be doing fast inference on a pi[0] using stylegan, but that's before…

The quality is not really close, also StyleGAN2 is not conditioned on text.

Sorry, I left too much knowledge for inference.

I presumed it was safe to let users infer that a 2018 (StyleGAN) or 2019 (StyleGAN2) model was not going to compete with performance of a 2023 model, regardless of architecture. There has in fact been improvements in GANs in the last 5 years. Text conditioning is not unique to diffusion and is rather a subnetwork for conditioning (actually StyleGAN's whole innovation was creating a subnetwork for conditioning synthesis)

There are definitely modern GANs that are T2I and computationally cheaper than a latent diffusion model for a comparable benchmark score (but recognizing that our metrics are limited and only rough qualifications of image quality, but that the meaningfulness of the metrics decreases with increased realism so that's not really a hindrance for our specific use case and as mentioned before decreased diversity.)

> The quality is not really close, also StyleGAN is not conditioned on text.

Some examples of T2I GANS with comparable quality (not even something I claimed for context of the request...):

- GigaGAN (2023). Base generator @ 652.5M params and upsampler @ 359.1M params. While 512x512 generation has similar model size to SD 1.5 the inference speed is 16x faster. The gap widens for text conditioned super-resolution 128->1024 https://arxiv.org/abs/2303.05511

- StyleGAN-T (2023) (notably by Sauer who recently joined Stability and their first paper hit the front page a few weeks ago. Also includes the main SG authors from Nvidia) Figure 1 speaks for itself, noting that this is on T2I. It's also worth noting Sauer's previous work (StyleGAN-XL (2022)) did text conditioned experiments. https://arxiv.org/abs/2301.09515

- LAFITE (2022) comes in at a tiny 75M params for 256x256 generation and has quality comparable to the 12B param (autoregressive) DALL-E while being 1,600x faster in inference https://arxiv.org/abs/2111.13792

There are plenty more too. I'm not even suggesting proven architecture and train under comparable settings to that which the popular diffusion models have been trained to (which would be a fair one-to-one comparison), but what has already been done and demonstrated because the context is an engineering project not research. Certainly all the above works, including may diffusion methods, would vastly were they given the same treatment as Stable Diffusion but that's not the context here.

Stop buying into hype. There isn't one model to rule them all, there are models that are better in differing contexts.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#42
post #35

Earlier quoted context omitted.

Wait, but the new title doesn't seem to be correct

We certainly want it to be correct! I took "Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2" from the About part of https://github.com/vitoplantamura/OnnxStream/tree/c0cb4b3d7b... . Is it wrong?

It looks like the reason it was submitted today is a new feature added "Added support for Stable Diffusion XL Turbo 1.0! (thanks to @AeroX2)", from the news section of the README.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#43

Earlier quoted context omitted.

This project is a fun POC but it's not very practical for that type of application. A 4090 can generate over 100 images a second with turbo+lcm and a few techniques, you can make 2 days worth of images in 1 seconds. You could make a years worth in roughly 3 minutes and put them on the sd card

Do your have references for that? I found this claiming an A100 can generate 1 image/s. https://oneflow2020.medium.com/text-to-image-in-less-than-1-...

> I found this claiming an A100 can generate 1 image/s.

The article you linked is over a year old. Needless to say there have been a LOT of optimizations in the last year.

Back then it was common to use 50+ steps for many of the common samplers. Current methods use a few steps like 1. This OnnxStream are using SDXL-turbo, and you can combine LCM and a few other methods to go very fast.

The reason it's so much faster now is the OnnxStream is only using a single step.

This repo claims 149 images/s on a 4090 https://github.com/aifartist/ArtSpew

However even if you only get 1 image/s with whatever GPU you have I stand by my original statement that unless you want to do it for the cool factor (which is very valid), pre-calculating them makes more sense.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#44
post #6

Earlier quoted context omitted.

That is, if you don't mind your wallpaper consuming 100% system resources, heh.

298MB of RAM is hardly 100%, as per this example. Slack takes up way more RAM than that.

Surely the CPU usage is what will cripple the pi?

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#45
post #40

Earlier quoted context omitted.

The quality is not really close, also StyleGAN2 is not conditioned on text.

Sorry, I left too much knowledge for inference. I presumed it was safe to let users infer that a 2018 (StyleGAN) or 2019 (StyleGAN2) model was not going to compete with performance of a 2023 model, regardless of architecture. There has in fact been improvements in GANs in the last 5 years. Text conditioning is not unique to diffusion and is rather a subnetwork for conditioning (actually StyleGAN's whole innovation wa…

>Stop buying into hype. There isn't one model to rule them all, there are models that are better in differing contexts.

I didn't say any of that, there is simply no open source GAN model that can compete with the open source diffusion models we have today, and the fact that these models can be distilled down to 1/2/4 steps makes GANs less attractive.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#46

Earlier quoted context omitted.

This project is a fun POC but it's not very practical for that type of application. A 4090 can generate over 100 images a second with turbo+lcm and a few techniques, you can make 2 days worth of images in 1 seconds. You could make a years worth in roughly 3 minutes and put them on the sd card

It's so nice of you to offer to buy 4090 cards for people who can only otherwise afford Raspberry Pis ;)

I was just using that as a reference. Stable diffusion will run well with almost any relatively modern gpu.

You don't have to use a 4090, you'll still get double digit performance with a 3060 or whatnot.

> for people who can only otherwise afford Raspberry Pis ;)

You can rent a 4090 for 0.7USD/1hr, or get an A100 for 1.1USD/hr. And if your project is a display + raspberry pi then those costs will dwarf the rental cost.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#47

Earlier quoted context omitted.

> But that's not the point, obviously. If you want to say the zero2-w is what's making it then sure. > Besides, a 4090 costs more than a car. They only cost ~0.70USD for 1 hr. In fact you could put this on an A100 for 1$/hr. Renting would make the most sense for this type of thing.

It depends on what you're using the images for. If there's a human in the loop, 100 images/s is likey too much volume, especially if prompt engineering is needed. At the same time, 2 images/hr is way too slow.

I mean, if you need a human in the loop to verify the image quality then you HAVE to pre-compute the images.

> 100 images/s is likey too much volume

You can always generate less

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#48
post #45

Earlier quoted context omitted.

Sorry, I left too much knowledge for inference. I presumed it was safe to let users infer that a 2018 (StyleGAN) or 2019 (StyleGAN2) model was not going to compete with performance of a 2023 model, regardless of architecture. There has in fact been improvements in GANs in the last 5 years. Text conditioning is not unique to diffusion and is rather a subnetwork for conditioning (actually StyleGAN's whole innovation wa…

>Stop buying into hype. There isn't one model to rule them all, there are models that are better in differing contexts. I didn't say any of that, there is simply no open source GAN model that can compete with the open source diffusion models we have today, and the fact that these models can be distilled down to 1/2/4 steps makes GANs less attractive.

> I didn't say any of that

I'm sorry, then I don't know what you're saying. Because what I read was 2 claims. 1) GAN quality is less than diffusion. 2) GANs can't do T2I. I think I adequately showed that both these assumptions were wrong. I'm not sure what else your comment meant as that contains all of its words...

> there is simply no open source GAN model that can compete with the open source diffusion models we have today

Again, I provided citations. Do you want the github links? Here's GigaGAN's: https://github.com/mingukkang/GigaGAN (checkpoints under the evaluation folder).

What do you mean by compete? Because the metric scores are quite comparable. I think that's a reasonable interpretation of the word "competitive" but I'm a generative researcher so we might be using the terms to mean different things. (I even like diffusion more fwiw, but I'm particularly more interested in tractable density models)

Do you mean "the open community has rallied around Stable Diffusion and sunk in more time to tuning this model and producing textual inversions and LoRAs which far out surpass that of any other model, even including other diffusion models and is a phenomena nearly exclusive to Stable Diffusion and has been mostly accomplished in the last year"? Because if so, yeah, I agree.

But that's not a really good argument for saying Diffusion is better than GANs. It's a completely different argument. That's just to say __Stable Diffusion__ (not the class of diffusion models, or even more specifically latent diffusion models (the two are different)) has better community support. That's a reasonable argument, but a different one. Because it really just shows what you can do to __any__ model. These techniques and efforts are not architecture dependent nor are they even mode dependent. We see similar community effort around OpenLLaMa and GPT but less so around Bard/Gemini or Claude. So what? That's not really relevant to the conversation nor to the specific context that we're discussing which is very likely not going to include many of those TIs or LoRAs (or if it would you'd probably be training a custom one, so the point is again moot since LoRAs are not unique to diffusion models). I'm really happy a lot of people have entered the community and are effectively doing research, but it'd be quite naive to say that such a thing isn't possible around other architectures. Evangelism is quite useful, but not if it turns into religious beliefs. Hell, we can argue that Linux is better than Windows because Linux has a bigger hacker community but I'm not sure that's a great or even meaningful argument because it's void of context in what better actually means. The better OS is clearly situationally dependent and makes a lot of the OS holy wars silly.

> and the fact that these models can be distilled

Literally any model can be distilled. I'm not understanding your argument. Are you just arguing that such efforts have already taken place? Sure, I'll agree to that. But it's worth noting that the distilled diffusion models are still quite large and much larger than some of the aforementioned works.

> 1/2/4 steps makes GANs less attractive.

I even addressed the one step process. Which, single step diffusion generation represents a significant decrease in quality, so this seems to run counter to your prior argument. This is why I'm a bit confused. If we're going with a low step diffusion model then the case for the GAN becomes clearer because even your non-distilled GAN's inference is still higher and it's quality is definitely superior.

So really, I am confused. I'm not sure what you're arguing.

We can get into the weeds and discuss diversity, recall, memorization, density estimation, and all manner of things but these are quite open questions and frankly understudied. Plus we'll have to be extra nuanced because the metrics are proxies and incorporate different biases that different architectures are going to suffer from, making it difficult to compare in a more fair sense. But that's okay.

Let's also be clear: GAN != StyleGAN{1,2,2-ada,3,XL,T,*} and diffusion != StableDiffusion. There are other GANs and other diffusions and even other image synthesis models, the vast majority of them being open source.

Again, I'll assert, there are no universal models that are best for all situations. There are only models that are best at specific situations. You can translate this to "AGI doesn't exist but we have narrow AI" if that is clearer. But my claim is a bit broader still because if that AGI took a warehouse to run it still wouldn't be contextually appropriate.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#49
post #32

Nice to see people finding way to get the square peg though the round hole. Something that I wondered when the Raspberry Pi 5 came out is the weirdness that might be possible now that they have their own chip doing IO cleverness. On the PI 5, the two MIPI interfaces ave been enhanced to do either output or input, It made me wonder if the ports are now generalized enough that you could daisy chain a string of PI 5's c…

The cheapest way to get a 80gig setup is to to only offload some layers to GPU, and use CPU/system RAM for the rest.

I run ~120GB models on my PC with a 7950X, 128GB DDR5, and RTX 3090.

Re: OnnxStream: Stable Diffusion XL 1.0 Base on a Raspberry Pi Zero 2

#50

Earlier quoted context omitted.

Every Google Home device is already running an ML model to do speech recognition to recognize the "hey Google" wake word, so sooner than 10 years. The Raspberry Pi Zero is a particularly underpowered device for this. Doing it on the Coral TPU accelerator plugged into a pi zero would take less than 30 mins. Doing it on an iPhone 15 would take less time. Doing it on a Pixel 8 would be faster. Not to diminish getting it…

There's an ocean of difference between optimizing for a single wakeword and the class of models that are taking off today. I'm excited for more on-board processing, because it will mean less dependency on the cloud.

I'm not going to argue that there isn't a difference when going from 0 -> 1 and 1 -> 10, or in this case, from 1.5b (Whisper-large) -> 1.7t parameters (gpt-4). But it's not like we don't know how to do it, so it won't take 10 years to get there.
Post reply on HN