Nodes/ComfyUI-BerniniR Wrapper/Bernini-R Context Window
ComfyUI Node

Bernini-R Context Window

The temporal window node that makes it possible

By xiaolibai-sys·Created 2 months ago·Updated 2 months ago· 9
Bernini-R Context Window
    • context_options
    context_schedulestatic_standard
    context_frames81
    context_stride4
    context_overlap16
    freenoisetrue
    fuse_methodsmooth
    rope_ntk_scale1.00

    Bernini-R inherits Wan's 81-frame native attention window, and if you've ever tried to push past it on a single GPU you know the wall: VRAM scales with the whole video being in memory at once. BerniniR_ContextWindow is the pack's answer - it tells the sampler to split the video into overlapping temporal windows, denoise each one, and fuse the results. Same machinery as WanVideoWrapper's context options, and it's the difference between "can't fit 161 frames" and "161 frames at a cost you can actually pay."

    How it works

    The sampler holds only a sliding window of frames in attention at a time. This node configures how those windows are scheduled, how much they overlap, and how the overlapping regions are blended back together. Four knobs decide the behavior, and they interact - so it's worth understanding them as a set rather than individually:

    • context_schedule - static_standard (simple sliding window, fastest), uniform_standard (multi-stride, best quality), uniform_looped (cyclic, for seamless looping videos).
    • context_frames - pixel frames per window. The README notes 81 ≈ 20 latent frames. Smaller = less VRAM but more windows and more blending work. This is your primary VRAM lever.
    • context_stride - stride levels on a log2 scale, uniform_* only. Higher = more window positions = smoother but slower.
    • context_overlap - overlap between windows in pixel frames. 12-16 is typical; higher smooths transitions. When you see seams, this is the first thing to raise.

    Plus two more in the optional row:

    • freenoise - shuffles noise across windows to reduce seam artifacts. Keep it on.
    • fuse_method - how overlapping regions blend: smooth (smoothstep crossfade, softest seams), linear (crossfade at edges), pyramid (triangle weights peaking at center). The README suggests pyramid as the seam-fighting upgrade.
    • rope_ntk_scale - NTK RoPE frequency scaling for sequences longer than training. 1.0 = off; 2.0 lets the model handle ~2× training length before positional collapse sets in. If your long videos come out structurally wrong, this is the knob that fixes positional confusion.

    Output and wiring

    One output: context_options (BERNINI_CTX). It plugs into the context_options input of BerniniR_KSampler or BerniniR_DualExpertSampler. Leave it disconnected and sampling is single-pass - which is correct behavior for clips that fit.

    The realistic play

    There's no free lunch: windowed sampling trades VRAM for seams and extra compute. The community-tested pattern for long Bernini/Wan clips is to lower context_frames aggressively (41 or even 25), keep context_overlap at 16 or so, and pair the whole thing with BerniniR_BlockSwapArgs if you're under 16GB - the context windows handle temporal memory, block swap handles the weights. If seams show up, overlap first, then pyramid fuse, then uniform_standard. One warning: Bernini has no first-frame/last-frame chaining and doesn't work with SVI-style extension, so windowed generation is the way to get long takes here - and identity drift across chunks is a real, model-level limitation no amount of overlap fully fixes.

    CategoryBernini-R/Sampling

    Inputs (7)

    NameTypeDefaultDescription
    context_scheduleCOMBOstatic_standardWindow scheduling: 'static_standard' = simple sliding (fastest), 'uniform_standard' = multi-stride (best quality), 'uniform_looped' = cyclic for seamless looping
    context_framesINT812–1000Pixel frames per window. 81 ≈ 20 latent frames. Smaller = less VRAM, more windows
    context_strideINT41–100Stride levels in log2 scale. Higher = more window positions (uniform_* only)
    context_overlapINT160–100Overlap between windows in pixel frames. Smooths transitions. 12-16 typical
    freenoiseBOOLEANtrueShuffle noise across windows to reduce seam artifacts
    fuse_methodoptCOMBOsmoothBlending: 'smooth' (default) = smoothstep crossfade (softest seams), 'linear' = crossfade at edges, 'pyramid' = triangle weights peaking at center
    rope_ntk_scaleoptFLOAT1.001–8NTK RoPE frequency scaling for sequences longer than training. 1.0 = off. 2.0 = moderate (2x training length), 3.0+ = aggressive. Scales rope_embedder.theta to prevent positional collapse.

    Outputs (1)

    NameTypeDescription
    context_optionsBERNINI_CTX