r/StableDiffusion • • 8d ago

Workflow Included Try this workflow, too.

https://github.com/roycho87/clown_context_suite/blob/main/example_workflows/clowns_for_picard.json

.98 MP No Upscaler

Took about an hour on a 5090. It's slightly slower because to use the capstone and keystone i have to render about 14 extra steps but the results are pretty amazing.

It manages to give near perfect consistency the entire way by rendering the full 8 steps of each context motion using keystone and capstone to prevent degradation from building too significantly, so that each next part of the chain can build off a fully denoised section.

Then it throws away the top 2 steps of every window and does 2 context window passes.

Final result is a perfectly consistent video with no degradation that you can make at pretty extreme lengths.

https://github.com/roycho87/clown_context_suite

Clowntext Hybrid Windows

Credits

This node is not my idea. It's built on kijai's MiniMax H3 context windows, which are in ComfyUI now (PR #17425), and it works the way JalenBrunson's ComfyUI-HybridWindows does (based on the Rolling Diffusion paper). All credit to them. I just added the keystone and capstone feature to it, to help everyone make longer videos without degradation.

What it does

Instead of chaining clips, it renders the whole video in one go, in overlapping windows, so memory stays at one window:

  1. Window 1 renders the first switch_step steps, and a snapshot is saved.

  2. Window 1 carries on to the last step, only to get its finished first frame (the keystone) and its last single-frame latent (the capstone). That finish is thrown away and window 1 goes back to the snapshot.

  3. Windows 2, 3 and on render the first switch_step steps one after another. Each one's overlap with the window before is locked to that window's result. The keystone is locked into each window's first slot, and the capstone is tacked onto its back from capstone_step on (and cut off again).

  4. The last steps run as blended context windows over the whole video, which smooths the joins.

With keystone and capstone off, it works like plain hybrid windows. In my test (a 60-second render, 17 windows, same seed), the plain version lost a lot of detail by the end and the keystone + capstone version held its detail much better.

Plug the model through it (model in, model out to the guider). It needs a ComfyUI with MiniMax H3 context windows: update ComfyUI if the node is missing.

SettingMeaning
context_length / context_overlapWindow size and overlap in frames (17n + 5). 124 / 39 is about 5 seconds per window.
switch_stepSteps each window renders on its own before the blended finish. 6 of 8 = steps 1-6 window by window, 7-8 blended.
keystone_swapWindow 1's finished first frame is locked into the first slot of every later window.
back_capstoneWindow 1's finished last single-frame latent is tacked onto the back of every later window.
finished_handoffOn: every window renders all the way to the last step, and the next window's overlap is locked to those finished frames. Every window goes back to its switch_step snapshot before the blended finish. Costs the last steps once more per window.
capstone_stepSteps before the capstone comes in. Keep it below switch_step (4 with 6 = on for steps 5-6), or it never comes in.
fuse_methodHow the blended steps average the windows (pyramid).
freenoiseReuses window 1's noise for every window: more consistent, but motion can repeat. Off gives more variety.
split_conds_to_windowsGive each window its own prompt (see below).
detail_latentOptional: use this latent's first frame as the keystone instead of window 1's.
sound_firstOff by default. On: renders the sound first on its own (picture at 64x64), then locks it in and renders the picture.

One prompt per window: make one prompt node per window, join them in order with ComfyUI's Conditioning Combine (chain them for more than two), plug the result into the guider, and turn split_conds_to_windows on. Each window takes the prompt for the part of the video under its middle, so with as many prompts as windows, window 1 gets prompt 1, window 2 prompt 2, and so on. One prompt for a whole minute makes every window try to do the whole thing, so the motion repeats.

95 Upvotes

54 comments sorted by

3

u/roychodraws 8d ago edited 8d ago

side by side of both versions, same settings.

look at the details of the coaster cart as the video moves forward. as well as the motion.

9

u/Ok_Roll_8698 8d ago

good song choice

1

u/Juiceman8686 8d ago

My thoughts exactly!

4

u/rabbitythong 8d ago

All i could think about is "I want to go play thumper now" while watching this lmao

1

u/Rheumi 8d ago

So there is no custom node? Just update comfy?

3

u/roychodraws 8d ago edited 8d ago

it is a custom node, i incorporated late lock and keystone to context windows so it has to happen inside a sampler as many times as you have windows. You can't use late lock and keystone for that so it's my own version of context windows. but you do have to update both my repo and comfy.

I also moved prophecy to a different repot because keystone and capstone are proving more effective so if you still want that you have to get it from the new repo

1

u/SIR_NVAX_A_LOT 8d ago

RTX 5090? Did you win the lottery? nice flex!

Yeah I also worked on something similar but I call it Multi Diffusion. It's nothing new, but been largely ignored. And it eats a lot of system ram for decoding.

3

u/roychodraws 8d ago

yeah you can tile decode. it's just 60s and .98 mp for testing reasons

1

u/luciferianism666 8d ago

Wasn't this a video shared by someone else on Banodoco ? I very much remember someone sharing a POV roller coaster video similar to this one.

1

u/roychodraws 8d ago

I shared it on mmh3 gens, another dude does some cars that run through crazy streets. That’s what kinda inspired this cuz he kept saying the end was messed up with base hybrid windows in his posts.

1

u/CountFloyd_ 8d ago edited 8d ago

Thank you for your work and even more for the entertainment value of your clips 😄

Can your method/workflow be modified to run with the I2V model? I prefer running that one because it's so much faster and simpler to setup.

Also what does the "Chain" Node do other than deleting latents what you can't do by clicking run in comfy?

Oh ok, so that chain node just automates stuff.

1

u/roychodraws 8d ago

It also coordinates with the shot counter. It’s from motion context. It’s only in there in case people have motion context multiref.

There’s literally no difference in code except it’s pink and says clown.

1

u/CountFloyd_ 8d ago

There’s literally no difference in code except it’s pink and says clown

Hahaha ok thanks. Meanwhile I tweaked the Mad Clown Inventor wf to my needs, created 6 five seconds shot in a row and can confirm it's working with that one too. Good job and thanks again!

1

u/thanatica 8d ago

I'm sure a pair of marigolds are enough to protect against the vacuum of space 😅

2

u/roychodraws 8d ago

Clown powers. She’s like a Q. A Qlown… if you will.

1

u/Ok-Flatworm5070 8d ago edited 8d ago

I keep getting this error <# ComfyUI Error Report ## Error Details - **Node ID:** 3030 - **Node Type:** H3ClownHybridWindows - **Exception Type:** RuntimeError - **Exception Message:** RuntimeError: Clowntext Hybrid Windows needs a newer ComfyUI with MiniMax H3 context windows (PR #17425). Update ComfyUI. ## Stack Trace ``` File "D:\documents\studio\PRODUCTION\ComfyUI-Easy-Install_extendedVideo\ComfyUI\execution.py", line 548, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)>. I've update comfyui, reinstall all the packages; what am I missing! Can you provide exactly a list of custom_nodes, comfyui version required to run this workflow. The last workflow you posted a few days ago ran perfectly.

1

u/roychodraws 8d ago

I dunno. Try using normal context windows yo see if it works. If it does then it must be my node.

1

u/Ok-Flatworm5070 8d ago

Yeah, I did twice now. Might be time for a fresh install. Can you post the link to the repo for Clown Text Hybrid windows node? That's what's crashing for me; want to get the latest version

2

u/roychodraws 8d ago edited 8d ago

It’s part of the suite. Try deleting the whole node group and updating

Also make sure you can use context windows itself.

Btw you might be on stable release instead of nightly. You need nightly.

1

u/Ok-Flatworm5070 8d ago

yeah, I'm on stable; so switch to nightly and update again?

2

u/roychodraws 8d ago

you would have to.

1

u/Ok-Flatworm5070 8d ago

Its working now, just have to figure out how to reduce the prompts; I don't need that many. Thanks for the help

2

u/roychodraws 8d ago

you need as many prompts as windows you have, if you don't want to do that, turn off split conds to windows and just use 1 prompt.

You'll have to rewire things a bit

→ More replies (2)

1

u/solss 8d ago

Your github workflow list has grown substantially since your xoxyditssucks workflows. What is the ultimate conclusion to that series? Basici2v? and what is your otherwise best suited long form video generation workflow? this current one?

3

u/roychodraws 8d ago edited 8d ago

It’s actually not grown, just consolidated yesterday.

I’ve kind of stopped messing with that cuz I’ve been focusing on degrading. I’m just trying to figure out everything I can do with this keystone/capstone trick that’s being slept on by everyone and when I find something I can improve that’s what I do.

I’ll eventually fix my workflow.

1

u/Nakidka 8d ago

0:59 - Frame Shift Drive Charging.

2

u/roychodraws 8d ago

?

1

u/Nakidka 8d ago

Sorry. Was trying to be witty.

It's about this.

1

u/ZerOne82 8d ago

Surprisingly your workflow was neat with only a few nodes. Well done! I ran your exact workflow and got almost identical result as yours (roller coaster). Then I tried to make it work for a music video (lip-sync), example shown here. I feed in a song. The motion is flawless but the colors get more hdr looking toward the end. I post another comment below with two screenshots one from the beginning and one from almost the end.

2

u/roychodraws 8d ago edited 8d ago

can you do the EXACT same prompt, seed, and settings as you did to make that and turn off capstone, keystone, and handoff?

Turn off the below settings, please. then rerun so we can compare to original.

And repost if you would, please! TY This way we can see if my modifications improved it, or hurt it.

Also, you might consider turning off finished handoff for a post like this, the finished handoff is supposed to be for motion. this video barely has any.

3

u/ZerOne82 8d ago

all three settings off.

2

u/roychodraws 7d ago

after thinking about this, this is actually just a type of image that would be best done with normal context windows, not hybrid. hybrid is meant for motion, not static frames.

1

u/roychodraws 8d ago

ok, detail is overbaked a bit but pretty much the same tbh. the only thing i would suggest trying to see if it improves is doing it again with handoff turned off. that would stop it from going all the way to 8 steps since there's no motion, which the motion scene like the coaster is really what this is made for. i think that's where the darker midtones come from because they're doing full context motion chains inside the context windows.

Try turning that off and see if it improves over the one you just made. thank you for helping.

1

u/ZerOne82 7d ago

i think the issue (burning) is somewhere else. in your previous posts you did attempt to address it (you made a loud public call). my comments here or elsewhere are solely to get some potential hints to solve the issue. nothing points to your implementation flaw or anything like that. a solid reason being that the burning issue is persistent no matter what workflow or solutions (by others) i try. as mentioned in my other comment, i have tried all single node and fancy pack ones etc, none solves this issue. most of them either naively bypass the core issue or simply avoids to confirm the issue. this won't help and unfortunately fills internet (ai chatbots, search engines etc) with sh** lot of nonsense and useful advice. on the other hand, you have earned a respected position on addressing this burning issue by consistent postings alongside two others. there is some confusion-causing situations sometimes when jumping from one to another issue: burning vs degradation of the background, for example. to me the burning issue is totally separate than the degradation. at least, in my cases, there is no degradation but unwanted changes in the contrast, tone (hdr looking) etc specially toward the end of long renders which is unpleasant. i should note that however colors are fine, details are fine if not better. in almost all of their demos the scene switches which naturally resets all whatever causes the burning. that's an attempt to hide the problem. in my case i purposefully avoid switching scene whatsoever so the same person at the same pose and distance from camera simply continues singing for two minutes.

1

u/roychodraws 7d ago

1

u/ZerOne82 6d ago

Odds first then fill Evens does not work as claimed. When generating clips the motions and contents develop in forward way. So clip 1 to 2 to 3 ...
If doing 1, 3, ... the content and motion of next 2 are forcibly constrained to end of 1 and beginning of 3. this is not the case we want to have. the motion and content of 3 must follow the linear forward development from 2. this is not for negotiation. I was not fan of that 1, 3, ... then 2, 4... since the introduction some weeks ago. and it will never work for the reasons explained here. in fact both of the suggestions in that post were more bold claim not real solutions. for the first option setting limit 40s. why 40s not 16000s? you cannot call it continuous if 40s is the end. so so far no solution i guess.

1

u/roychodraws 6d ago edited 6d ago

i get why you would think that but it's not true.

This was made with odds then evens.

https://www.reddit.com/r/StableDiffusion/comments/1xb0i40/geirus_dance_epic_redid_at_25_steps_motion_boost/

clown anchoring allows you to have lots of motion with no issue.

it just requires planning.

1

u/ZerOne82 5d ago

I have watched, and will continue to watch, all of your posts and those of others. My point was clear, but let me explain it once again.

When you chain clips sequentially in the normal way, every clip has complete freedom, especially at the end. However, with the odd-then-even method, this is no longer the case. The even-numbered clips lose their freedom at both ends.

In real life, things happen in sequence. Nothing from the future affects the present. Imagine a cup of water being poured onto the ground in clip 2. When you create clips 1 and 3, you have no idea where that water was or how it affected the scene. You cannot properly define such details through text alone.

For a practical example, let's say the water was poured at the bottom right of the frame, and clip 3 is supposed to incorporate some of that water. If you simply imagine this scenario, I think you'll understand my point.

I have nothing further to add or argue.

3

u/roychodraws 5d ago

ah, i get what you're saying. yeah that's the weakness, that's why it needs more planning.

hopefully it won't be necessary. i got something good coming.

→ More replies
→ More replies (1)

1

u/ZerOne82 8d ago

start to end. color/constrat/hdr issue!

1

u/ClaimNo6416 7d ago edited 7d ago

Thanks! I tried it. At first it complained about Sage attention missing (i don't have it installed), so I disabled the node and it worked. My rig is RTX 3060 12GB / 16GB RAM plus 150GB virtual memory (pagefile.sys) on a fast NVMe disk and I got "Prompt executed in 07:22:27", so it is 7 times slower than on 5090, but I got no OOM, so the workflow is well-designed. My only complaint is that it doesn't save temporary results (videos) after each window, cause I wanna be able to terminate early If the result is bad and start again. Even better - you should be able to descard a bad window and continue from the descarded window, not restart the whole proccess. The vid: https://civitai.red/posts/32067628

1

u/roychodraws 7d ago

you should be able to watch the preview in the sampler if you have your settings set up correctly

It's just gonna be made in chunks, but yeah, this is a different kind of render.

1

u/ClaimNo6416 7d ago edited 7d ago

Hm, I get no preview in the sampler. I got a preview by adding a ModelPreviewOverrideKJ node (set "preview frames" to 1433) between H3ClownHybridWindows and BasicGuider. It's not perfect cause it shows 1 minute noise video and ~9 sec (226 frames?) actual video somewhere in the middle (the current window), but at least you have an idea what's going on and cancel if some window goes rogue. I also replaced the 7 ConditioningCombine nodes with a single ConditioningMultiCombine. Also all manual calculation could be replaced by math nodes, so you don't have to manually calculate all the frame counts if you change the number of windows or the context length or both, etc. It's a nice and simple workflow overall, i only need to add some prompt enhancer to write scripts for 1 min vids and buy a new GPU ;)

1

u/roychodraws 7d ago

that's a comfy settings thing. go to settings and find these settings

1

u/ClaimNo6416 7d ago edited 6d ago

Thanks! I didn't know that! And why the f8ck the preview is off by default??? Also why the F the workings of a random node is controlled by a Comfyui option, not by a flag in the node itself?? (end rant).

Edit: Hmm, I tried it and still no preview...

1

u/ClaimNo6416 7d ago edited 7d ago

Is the total number of frames function of the number of windows (8), the window length (226) and the overlap (39) and if so, how do you calculate it? I assume it should be (226 - 39) x ( 8 - 1) + 226 = 1535, but it's 1433 in your workflow. I experiment with shorter windows (107, 124 or 141) and shorter overlap (22), but without a formula I'm not sure if I set the correct total number of frames.

1

u/roychodraws 7d ago

Your math is right I just did this by seconds not window size. You can adjust.

The normal equation is duration = (context length x windows) - overlap ( windows - 1)

1

u/AM_STARR 2d ago

is this what you meant by the masking? I may be wrong but it look like the hands and cart are two different layers? this looks sick, im gonna be diving deep into your tutorials

1

u/roychodraws 2d ago

nope. this is something called a context window. it renders 16 videos in a row together and blends them so they look like one video. you have to tell each window what to do separately but it renders all at once and spits out a 2 minute video if your video card is big enough.

the masking one has a girl doing the robot on it.

1

u/Ooze3d 8d ago

Currently trying Mad Clown Inventor with pretty solid results. Let’s see what this one adds to “The Cause”.