Nodes/ComfyUI Model Bending/Temporal Shift Module (Bending, Experimental)
ComfyUI Node

Temporal Shift Module (Bending, Experimental)

Move content forward or back in time

By abuzreq·Created 2 years ago·Updated 11 days ago· 26
Temporal Shift Module (Bending, Experimental)
    • BENDING_MODULE
    ◄frames1►
    ◄paddingborder►

    Temporal Shift Module is the temporal equivalent of the Translate module: instead of moving content left or right inside a frame, it moves content earlier or later in time by whole latent frames. Shift by one and each moment of the video is what the model thought was happening a moment ago.

    That reads as trail, echo, pre-roll or stutter depending on which direction you push it and how it's gated - and unlike most of this pack it doesn't need any knowledge of layer paths to be interesting.

    How it works

    The frame axis of the 5-D tensor is index-selected with an offset, and the padding mode decides what fills the gap at the leading or trailing edge:

    • border (default) - the edge frame is repeated. Content appears to hold at the start or end of the clip. Usually the least distracting.
    • wrap - the stack rolls around, so the clip's end feeds its beginning. This is the loop-friendly mode: shift by a quarter of the clip and you've built a seamless-ish time offset rather than a hole.
    • zeros - empty frames at the edge, which the model reads as "nothing here" and will cheerfully fill with whatever it was going to draw anyway. Occasionally produces a dissolve, usually produces a weird first or last frame.

    The unit is latent frames, and on WAN one latent frame is four video frames. The range is −64 to 64. A magnitude larger than the clip's frame count is clamped by the index selection rather than exploding, but the effect of "shift by more frames than exist" is just a held edge or a wrap, so keep it small: 1 to 3 covers most ideas.

    Only 5-D video tensors get shifted. A 4-D input, or a 5-D input with fewer than two frames, passes straight through unchanged.

    Inputs and output

    • frames - default 1, range −64 to 64, integer. Positive shifts content later in time (each frame shows what was one frame earlier, i.e. a trail); negative pulls it earlier.
    • padding - border (default), wrap, zeros.

    Output: BENDING_MODULE.

    Wiring it

    Into DiT Block Bending on a WAN-family model with spatial: true - the pack's temporal workflow does exactly that with frames: 2, padding: border, on double:10-20, which reads as a two-latent-frame (eight video frame) echo baked into the model's mid-stack representations.

    Or into Attention Map Bending, where shifting the map's frames means a prompt token's influence at frame f comes from the region it was attending to at frame f−n. For a moving subject that produces a lagged, dragging follow-through - one of the cleaner "the model did something physical" results in this part of the pack.

    Both routes want the early steps if you're chasing motion quality: layout and motion arcs are decided while t is high, and later steps mostly render. Timestep Gated Bending is the natural companion, and on anything long it's close to mandatory, because re-shifting at every step compounds - twenty steps of a two-frame shift in the early denoise is a very different animal from a two-frame shift applied once.

    Install

    ComfyUI Manager → search "ComfyUI Model Bending", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/abuzreq/ComfyUI-Model-Bending
    pip install -r ComfyUI-Model-Bending/requirements.txt
    

    kornia and scikit-learn; restart ComfyUI after. The pack ships no weights - the WAN checkpoints come from the download links in the example video workflows.

    Where people get burned

    • Assuming it's a frame-rate trick. It doesn't retime the clip or change its length. The output is the same number of frames; the model's beliefs about them moved.
    • zeros at small shifts. One zeroed frame at a clip edge can pull a black band or a weird chunk into frame one, and then the sampler builds a plausible object out of it. border if you're unsure.
    • Shifting, then blurring temporally on the same blocks. They do similar things by different means and the combination mostly produces mush. Pick one.
    • Expecting a clean offset. Shifting the representation isn't the same as shifting decoded pixels; the model reconciles the offset with what it thinks should be there, so you get lag with occasional invention.
    • Ignoring the experimental label. These temporal modules were validated on tiny random-weight WAN models in the test suite, not real weights. You're exploring, not configuring.
    Categorymodel_bending/video (experimental)

    Inputs (2)

    NameTypeDefaultDescription
    framesINT1-64–64Latent frames to shift (WAN: 1 latent frame = 4 video frames)
    paddingCOMBOborder3 options: border, wrap, zeros

    Outputs (1)

    NameTypeDescription
    BENDING_MODULEBENDING_MODULE—