KJNodes/miscgenerated

Context Windows Visualizer (KJ)(ContextWindowsVisualizerKJ)

Interactive visualization of ComfyUI context windows: window placement, overlap, fuse weights and per-frame blending, updated live. Optionally applies the settings to a model like the core Context Windows (Manual) node.

Context Windows Visualizer KJ

model
model
frame_units
pixel
dim
2
temporal_downscale
4
num_frames
161
context_length
81
context_overlap
30
context_schedule
COMBO
context_stride
1
closed_loop
fuse_method
pyramid
causal_window_fix
freenoise
cond_retain_index_list
STRING
KJNodes

Description

An interactive visualization node for ComfyUI context windows. It displays window placement, overlap, fuse weights, and per-frame blending in real time as parameters are adjusted. When a model is connected, the node optionally applies the configured context window settings to the model during sampling, functioning similarly to the core Context Windows (Manual) node.

Inputs

All inputs control the visualization and, when a model is connected, the applied context window behavior.

  • model (MODEL, optional)
    An optional model to apply the context windows to during sampling. When disconnected, only the visualization is shown.

  • frame_units (COMBO, default: pixel)
    Units for frame counts.

    • pixel: Converts pixel frame indices to latent indices via ((n - 1) // temporal_downscale) + 1.
    • latent: Frame counts are treated as latent frame indices directly.
  • dim (INT, default: 2, range: 0–5)
    Latent temporal dimension index. 2 is typical for WAN-like architectures; 0 for AnimateDiff-style. Only relevant when a model is connected (“model path”).

  • temporal_downscale (INT, default: 4, range: 1–16)
    VAE temporal compression factor used when frame_units = pixel. Common values: WAN/Hunyuan/CogVideoX = 4, Mochi = 6, LTXV = 8.

  • num_frames (INT, default: 161, range: 1–100000)
    Total number of frames to visualize when no model is connected (visualization-only path). When a model is connected, this is ignored and the real latent length of the model is used.

  • context_length (INT, default: 81, range: 1–100000)
    Window length in frame units.

  • context_overlap (INT, default: 30, range: 0–100000)
    Number of overlapping frames between adjacent windows.

  • context_schedule (COMBO, no default)
    Determines window placement strategy.

    • standard_static_balanced: Static windows spread evenly across the frame range, guaranteeing uniform seams for any frame count.
    • batched_shifted: Zero-overlap windows whose seam positions roll each sampling step (~1.0× compute; intended to pair with FreeNoise).
      Uniform schedules (future additions) also shift per step.
  • context_stride (INT, default: 1, range: 1–32)
    Maximum stride power for uniform schedules. Controls dilated windows (e.g. 1, 2, 4…). Only effective when a uniform schedule is selected.

  • closed_loop (BOOLEAN, default: False)
    When enabled, wrap looped-schedule windows around from the end back to frame 0.

  • fuse_method (COMBO, default: pyramid)
    Blending method for overlapping regions. Options represent different weighting strategies (e.g., pyramid, uniform, etc.).

  • causal_window_fix (BOOLEAN, default: False)
    Prepend an anchor frame to non‑zero windows (except the first), which is stripped after the model call. Useful for causal temporal attention.

  • freenoise (BOOLEAN, default: True)
    Enable FreeNoise noise shuffling for smoother blending across windows. Only relevant when a model is connected (“model path”).

  • cond_retain_index_list (STRING, default: "")
    Comma‑separated list of window‑relative frame indices whose conditioning is reused across windows. For example, "0" reuses the first frame’s conditioning per window. Has no effect on the visualization; only applies when a model is connected.

Outputs

  • MODEL
    If a model was supplied as input, the output is the same model with the configured context windows applied. If no model was supplied, the output is None (the node acts purely as a visualization).

Usage Notes

  • The visualization updates live as any parameter changes, providing immediate feedback on window placement, overlap, and blending.
  • When using the node only for visualization (no model connected), the num_frames input sets the total frame count. Parameters marked “model path only” (dim, freenoise, cond_retain_index_list) are ignored.
  • Parameters effective only on the model path are clearly noted in their tooltips. The frame_units conversion only matters when deriving latent indices from pixel counts; if you work directly in latent space, set frame_units to latent.
  • For schedules like batched_shifted, pairing with freenoise is recommended for smooth transitions.
  • The causal_window_fix option is intended for models with causal attention (e.g., some video diffusion models) where each window needs a preceding anchor frame.

Comments

Sign in with GitHub to join the discussion.

Loading comments…
Context Windows Visualizer (KJ) (ContextWindowsVisualizerKJ) - ComfyUI-KJNodes | ComfyUI Wiki