Nodes/RES4LYF/TemporalCrossAttnMask
ComfyUI Node Runs on cloud

TemporalCrossAttnMask

Windowing which frames actually hear your prompt in Wan

By ClownsharkBatwing·Created 2 years ago·Updated 18 days ago· 1,222
TemporalCrossAttnMask
    • temporal_mask
    cross_attn_start1
    cross_attn_stop33

    RES4LYF's temporal conditioning system lets you change the prompt frame-by-frame inside a single Wan clip - genuinely unlimited zones, per the pack's own docs, and something no stock ComfyUI video workflow gives you out of the box. To do that, something has to control which frame range a given piece of conditioning is actually allowed to influence, and that's what TemporalCrossAttnMask builds: a mask over cross-attention, the specific pathway where your text conditioning reaches into the model at each frame.

    How it works

    Cross-attention is the mechanism that lets a diffusion transformer "listen" to your text conditioning at every frame it processes. This node produces a mask that opens that pathway for a specific frame window and closes it elsewhere, so a given conditioning branch only speaks during the frames you've assigned it. Stack a few of these against different prompts and you get the frame-by-frame prompt swapping the pack advertises - this node is one building block in that system, not a complete pipeline by itself, so pair it with whatever conditioning-combine node your temporal workflow uses.

    The inputs and outputs that matter

    • cross_attn_start (default 1) and cross_attn_stop (default 33) - the frame range where this conditioning is active. Note both step in units of 4, which lines up with Wan's causal VAE (4x temporal compression, so real clip lengths land on the classic 4k+1 pattern - 33, 65, 81 frames). Don't expect these fields to move one frame at a time.
    • Output: temporal_mask (MASK) - wire into your temporal conditioning combine node alongside the prompt this window belongs to.

    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. RES4LYF's example workflow for this system - "intro to clownsampling" in the repo's example_workflows/ folder - is worth grabbing before you build a temporal setup from scratch, since the wiring around masks like this one isn't obvious from the node alone.

    Common issues & troubleshooting

    Trying this on anything but Wan. Temporal conditioning in this pack is Wan-only per the README - regional conditioning (a different, spatial system) covers more model families, but frame-by-frame prompting doesn't.

    Ranges that don't add up to your real clip length. If your frames total elsewhere in the workflow doesn't match what your cross_attn_stop values assume, you'll end up with either dead frames that no conditioning reaches, or overlapping windows where two prompts fight for the same frames. Check your actual generated frame count before setting these.

    Confusing this with self-attention. This node only masks the prompt-injection pathway. If you also need to window frame-to-frame motion consistency (self-attention), reach for TemporalSplitAttnMask instead, which controls both independently.

    CategoryRES4LYF/masks

    Inputs (2)

    NameTypeDefaultDescription
    cross_attn_startINT11–18446744073709550000
    cross_attn_stopINT331–18446744073709550000

    Outputs (1)

    NameTypeDescription
    temporal_maskMASK