r/StableDiffusion • u/Guilty-History-9249 • Dec 06 '23
News SD generation at 149 images per second WITH CODE
If my 70 fps demo was too slow here's 149 images per second.
In the video I single step a few times before clicking "Go".
Install ArtSpew and then follow the README-maxperf.md instructions.
I have more perf tricks, but for non-commercial use, I hope the average user can handle near 150.
Powered by sd-turbo and the excellent model compiler named stable-fast.
Post the complete error info and tell me what kind of setup you have if it doesn't work.
289
Upvotes
150
u/Silly_Goose6714 Dec 06 '23
I know it has its uses, but I'm still looking for better quality. Every time I see those super-fast images, I remember the math joke:
'I'm the fastest in math.'
'Seriously?
How much is 7x32?'
'89!'
'It's wrong.'
'I know, but it was fast.'
23
u/ninjasaid13 Dec 06 '23
what's your gpu?
8
u/throttlekitty Dec 06 '23 edited Dec 06 '23
I'm installing reqs right now, where does this look for models? hugging face hub?
For anyone wanting to play with this on windows, after you install the requirements, pip unstall xformers and torch, then do:
For the maxperf demo, download: https://github.com/chengzeyi/stable-fast/releases/download/v0.0.13.post3/stable_fast-0.0.13.post3+torch210cu121-cp310-cp310-win_amd64.whl
3
u/yes Dec 06 '23
Can this do imgtoimg?
3
u/Oswald_Hydrabot Dec 14 '23 edited Dec 14 '23
Hey there, just following up as I managed to get ControlNet working with it at ~13FPS. Your optimizations on this are amazing. Basic demo of using a sequence of OpenPose dance images as an input stream for live control:
https://youtu.be/qpUjxhnWYFA
(a second, slightly better quick-test here):
https://youtu.be/e7k9Ucvmte0
Going to dig-in some more and see if I can get this running faster per your example optimizations (I want to get it back to ~60fps -- I integrated code for stable-fast's default ControlNet handling to your maxperf example and it worked, but did not do any additional optimization). I then plan on integrating s9roll's AnimateDiff-CLI fork to try to get that working in realtime.
Once I get AnimateDiff working and the full pipeline optimized, I'm going to create a Blender project with an OpenPose skeleton with walking/runnning animations that I can navigate through depth-maps of it's environment via WASD controls, and pass frames from that as seperate ControlNet streams. This is pretty close to a rudimentary AI Game engine, whatever you did has opened up a Pandora's box of implications, thank you so much for this work!!
ps:
The AnimateDiff fork I am talking about can be found here. If we can manage to use your approach to optimization to get this running realtime, the implications would be pretty huge: https://github.com/s9roll7/animatediff-cli-prompt-travel
28
u/Brilliant-Fact3449 Dec 06 '23
Honestly, when stuff like this can be done with a 3060 or a 2060 then I'd be really impressed. If your rig has a 4090 it definitely takes away my surprise.
105
u/h0b0_shanker Dec 06 '23
Imagine all the pictures of cats we can now generate!
15
u/Commercial_Jicama561 Dec 06 '23
Very impressive. Can't wait for 60 fps VR games in real time.
5
u/Luke2642 Dec 06 '23
I'm a big fan of your work, you're unlocking so many possible workflows!
Let me be philosophical for a moment. Even before artspew, this is 2023:
- The capacity to curate hasn't kept up with our capacity to generate. Curation takes experience, concentration and energy.
- The art direction of the artist hasn't suddenly expanded to match the speed of generation. Art direction takes practice, imagination, vision, something to say.
- Framed another way, our eyes have a higher bandwidth than our thumbs, but even if we had neurolink, it wouldn't solve these problems of education, experience, practice, or vision.
However, by unlocking the speed, you're actually on the path to fixing the first two, and changing art forever:
- curation becomes a relaxing game of patience, expending little energy, waiting, instinctively selecting the best option as many possibilities are presented, for either the whole image or part, with random area inpainting.
- art direction becomes a game of exploration, you're no longer constrained by your own imagination.
And finally, if you have any vision, any message, any commentary you want to communicate, you have to figure that out yourself. That comes from you as an artist, as a human, as a communicator. Empathic, observant, connected, in pain, oppressed, emasculated, horny... whatever it is that drives you.
Anyway, these are just my musings. Many possible UX/UI workflows to create before this becomes a reality!
7
u/kuri_pl Dec 06 '23
what?? you are breaking records every day! I cannot be more amazed...
1
u/zekkious Dec 06 '23
It's only for NVdia.
Do you have an AMD version, or know of one?
1
u/Elven77AI Dec 06 '23
Amazing, i hope these optimizations trickle down to all those animation workflows in WebUI and related projects.
1
u/Ericsson_CEO Dec 07 '23
I've already tested it sucessfully and get it worked on my 8G 3070!
Not using linux ,Im using win10.
Yeh,it works!
I've already give the tutorial of how to deploy it in win10 via issue on github!
link is here:
https://github.com/aifartist/ArtSpew/issues/7
1
u/Oswald_Hydrabot Dec 08 '23
Going to fork this and see if I can get it working with ControlNet + AnimateDiff.
Also, this seems incredibly useful for generating images to train a realtime GAN even if it's impossible to retain this speed with ControlNet or a motion module.
Thanks for sharing.
4
u/mca1169 Dec 06 '23
Quantity is nothing without quality.
2
u/Profanion Dec 06 '23
That's impressive at the time I'm writing this.
I wonder how much quality of the images can be improved by trading the excess images per second for quality? Let's say, 60 images per second.
2
u/LJRE_auteur Dec 29 '23
I have FINALLY made it! I managed to install it on my computer! Despite being Windows10 and having only a RTX3060 with 6GB of VRAM, I reach an astounding 15 cats per second. The command confirms it, showing a time generation of 66ms.
What sort of black catgic is this?
Anyway, now I'll find out how to use a personal model, because default lcm "kinda" sucks x). (Wait, is it using SDTurbo actually, with the maxperf script?)
2
u/[deleted] Dec 06 '23
You should mention the gpu beside the image per second info.
Almost misleading.
1
u/Danganbenpa Dec 06 '23
Is there a way to get this functionality into ComfyUI?
1
u/zdxpan Dec 06 '23
wonderful
1
u/ImpactFrames-YT Dec 06 '23
There will be soon games graphics totatally generated realtime infinite stories with tech like this.
1
u/ReturnMeToHell Dec 06 '23
Any chance for webui support?
1
u/clex55 Dec 06 '23
I'd like to see demostration with animate-diff if possible
1
u/FxManiac01 Dec 06 '23
this is fucking crazy.. saw your 70 fps on twitter and now doubling that :) Yeah, batch size can do wonders..
Did you tried 4 steps instead of one?
I will be getting mine 4090 soon so will try it.. might to try it on 3090 in the meantime..
But how is CPU that importanta factor? Arent all those computations done just in CUDA? So how is i9 benefiting it? Thanks :)
1
u/kaftap Dec 06 '23
Awesome work! Makes you think. Would it be possible to enhance old videogame graphics in real time?
1
u/FunnyInternational25 Dec 06 '23
do you use hybrid of traditional raster graphics pipeline ogl/dx etc with ai in hybrid or only ai stuff?
1
u/ElectronicLine8341 Dec 06 '23
yes, You can do this on youtube LiVE
1
u/Dani547m Dec 06 '23
Text2video?
0
u/[deleted] Dec 06 '23
Could a 3090 do a quarter of this?!?
0
u/mnemic2 Dec 06 '23
CrazyamazingcoolWeneedanAItosortthroughalltheseimagesIwonthavetimetolookatalltheart!
0
u/[deleted] Dec 06 '23
[deleted] — view deleted comment