ReWanPatcherAdvanced
Sliding-window attention for long Wan videos
- model
- model
The reason you'd reach for this: generating a long Wan clip in a single pass without your VRAM exploding. ReWanPatcherAdvanced patches a Wan video model to use sliding-window attention, and the author's own headline number is the pitch - he generated 601 frames in one shot on a single 4090, in about 25 minutes. That's the whole appeal. Normal full attention over a long clip scales badly; a sliding window keeps the compute bounded so length stops being the wall you hit.
Some context on where this sits. RES4LYF is ClownsharkBatwing's sampler pack, better known for its solvers and the beta57 schedule, but it grew a real set of Wan video tools alongside them - regional conditioning, temporal (frame-by-frame) prompting, and this patcher. The sliding-window trick is conceptually cousin to what other long-video methods do (FramePack, chunked attention): instead of every frame attending to every other frame at once, attention slides across a window, so memory doesn't grow linearly with clip length. The difference is this one is baked into a single model-patch node you drop in front of your sampler.
How it works
You feed it your Wan MODEL, turn the sliding window on, and it rewrites the self-attention so each position only attends within a moving frame window rather than the full sequence. Out comes a patched MODEL you sample as usual.
The inputs and outputs that matter
model(MODEL) in,model(MODEL) out - patched model goes to your sampler.sliding_window_self_attn(false/standard/circular) - the master switch.falseleaves attention untouched;standardis the ordinary sliding window;circularwraps the window around, which suits looping content.sliding_window_frames(default 60) - how wide the window is, in frames. Bigger windows hold more temporal context (more coherence) but cost more; smaller windows are cheaper and let you push length further. This is the knob you tune against your VRAM.enable(default true) - a quick bypass so you can A/B the patch without unplugging it.self_attn_blocks/cross_attn_blocks(defaultall) - which attention blocks the patch touches. Leave them atallunless you're doing something surgical.
How to install it
ComfyUI Manager: search RES4LYF, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF
cd RES4LYF
pip install -r requirements.txt
then restart and hard-refresh (F5). You'll need a Wan checkpoint loaded separately - this node patches it, it doesn't download anything.
Common issues & troubleshooting
It's a Wan node. The "Wan" in the name is literal - it patches Wan's attention specifically and isn't a general long-video fix for other model families.
Coherence drifts across the clip. If the subject wanders or loses consistency over a long generation, your window is too small to carry context that far - raise sliding_window_frames. If you're generating a loop and the seam is ugly, try circular.
Still running out of VRAM on very long clips. That 601-frame number was on a 4090; a smaller card won't match it. Shrink sliding_window_frames first (it's the biggest lever), then drop resolution or frame count. The window width, not the clip length, is what your memory is really paying for.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| self_attn_blocks | STRING | all | — |
| cross_attn_blocks | STRING | all | — |
| enable | BOOLEAN | true | — |
| sliding_window_self_attn | COMBO | false | 3 options: false, standard, circular |
| sliding_window_frames | INT | 604–18446744073709550000 | How many real frames each frame sees. Divide frames by 4 to get real frames. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |