Nodes/RES4LYF/TemporalSplitAttnMask
ComfyUI Node Runs on cloud

TemporalSplitAttnMask

Windowing self-attention and cross-attention separately in Wan

By ClownsharkBatwing·Created 2 years ago·Updated 17 days ago· 1,222
TemporalSplitAttnMask
    • temporal_mask
    self_attn_start1
    self_attn_stop33
    cross_attn_start1
    cross_attn_stop33

    TemporalCrossAttnMask windows one thing: which frames a piece of conditioning is allowed to talk to. TemporalSplitAttnMask does that plus the other half of the picture - it lets you window self-attention and cross-attention independently, in one node, instead of only touching the prompt-injection pathway. If you've already used TemporalCrossAttnMask and found yourself wanting to also control motion consistency separately, this is the node you were reaching for.

    How it works

    Two different attention mechanisms are doing different jobs inside a video diffusion transformer. Cross-attention is where your text conditioning reaches in at each frame - that's what decides what a frame shows. Self-attention is frames relating to other frames within the same generation - that's what keeps motion and structure consistent across frames. Most of the time you want self-attention flowing freely across the whole clip so motion stays coherent, while still swapping which prompt is heard at different points. This node decouples the two: you get a separate start/stop range for each, so you can, say, keep a wide self-attention window for smooth motion while narrowing the cross-attention window to swap prompts mid-clip.

    The inputs and outputs that matter

    • self_attn_start / self_attn_stop (defaults 1 / 33) - the frame range where self-attention (frame-to-frame consistency) applies.
    • cross_attn_start / cross_attn_stop (defaults 1 / 33) - the frame range where cross-attention (prompt injection) applies.
    • All four step in units of 4, matching Wan's causal VAE frame counts (33, 65, 81, and so on).
    • Output: temporal_mask (MASK) - into your temporal conditioning combine node.

    How to install it

    Via ComfyUI Manager: search RES4LYF, install, restart.

    Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ClownsharkBatwing/RES4LYF
    cd RES4LYF
    pip install -r requirements.txt
    

    Portable installs: use the embedded Python's pip.exe. Start from the pack's "intro to clownsampling" example workflow rather than wiring this from a blank graph - the temporal conditioning system this node is part of has a few moving pieces that aren't obvious from any single node.

    Common issues & troubleshooting

    Overkill for a simple two-prompt clip. If you don't actually need self- and cross-attention windowed differently - you just want the whole clip's attention to switch together at one point - TemporalMaskGenerator or TemporalSplitAttnMask (Midframe) is the simpler node and easier to reason about with four fewer numbers to track.

    Four numbers, easy to mix up. With start/stop for two separate attention types, it's simple to set a range backwards or leave cross-attention wide while meaning to narrow it. Start from sensible wide defaults and narrow one pair at a time rather than guessing all four at once.

    Wan only. Like the rest of this mask family, temporal conditioning is a Wan-specific feature in this pack - it won't do anything on other model families.

    CategoryRES4LYF/masks

    Inputs (4)

    NameTypeDefaultDescription
    self_attn_startINT11–18446744073709550000
    self_attn_stopINT331–18446744073709550000
    cross_attn_startINT11–18446744073709550000
    cross_attn_stopINT331–18446744073709550000

    Outputs (1)

    NameTypeDescription
    temporal_maskMASK