Nodes/ComfyUI_FlashVSR/FlashVSR Sampler (streaming sparse)
ComfyUI Node

FlashVSR Sampler (streaming sparse)

Your width and height are the input size, not the output

By smthemex·Created about a year ago·Updated about a month ago· 422
FlashVSR Sampler (streaming sparse)
  • model
  • image
  • latent
◄width1280►
◄height768►
◄seed0►
◄scale4►
◄kv_ratio3.5►
◄local_range11►
◄sparse_ratio2.0►
◄offloadfalse►
◄chunk_q0►
◄long_modefalse►

Video super-resolution is the awkward third job in upscaling. Pixel upscalers are cheap and can't invent detail; image models invent detail but can't agree with themselves frame to frame, which is why a per-frame upscale of patterned wallpaper turns into a jittering mess. FlashVSR is a diffusion model built for the temporal version of that problem, and it got adopted on speed rather than quality - genuinely faster than SeedVR2, noticeably less impressive when your source is truly wrecked. This node is the sampler at the centre of smthemex's native port: frames in, a latent out. There's no step count, no sampler dropdown, nothing to tune in the usual sense - you're holding a throttle, not a creative dial.

How it works

FlashVSR is a one-step DMD model: the denoise happens at a single sigma of 1.0, so there's no noise schedule to explore. It walks the clip in a sliding window instead, caching previous KV and attending sparsely across it - the "streaming sparse" in the display name. Under the hood it patches the loaded Wan-format DiT: each block gets the low-quality residual injected, a block-level top-k mask replaces full attention, temporal RoPE shifts per window. For the 1.0/1.1 weights nothing needs diffusers or a compiled attention extension; the sparse path is plain torch.

Two consequences you'll notice. Memory scales with target resolution squared, because the token grid does. And the model wants a specific frame count: it pads your clip with duplicated tail frames to a 8n+1 length, then the decoder trims the padding. Short clips are not its friend - under 25 frames it won't even start.

The inputs that matter

image is a batch of frames, so wire in GetVideoComponents' images or a Video Slice. A single still image gets repeated into a 25-frame clip - a legitimate way to test settings before committing to video.

width and height are the trap, and the tooltip says it plainly: they're the LQ regularised size, and your frames get nearest-exact resized to exactly that first. scale (1–4) then bicubic-upscales the LQ by that factor and centre-crops to a multiple of 128. So 1280×768 at scale 4 means a 5120×3072 target, which will not run on your GPU. Set these near your source resolution - 640×480, 512×384 - and let scale do the multiplication.

kv_ratio (default 3.5) is the sliding KV window in groups of two latent frames; the code truncates it, so 3.5 is a 3. More context costs memory and buys temporal stability. local_range is the one the author answers for you: 9 sharper, 11 more stable, and 11 is the official recommendation. sparse_ratio sets how many blocks the sparse attention keeps - higher is denser and slower. chunk_q is the VRAM release valve: query chunk, multiple of 128, 0 means auto, smaller means less memory at a speed cost.

offload unloads the DiT after sampling, which you want if the VAE decode is where you're dying. long_mode emits per-window latent segments instead of one joined latent, for very long clips - it needs the TCDecoder selected in the VAE loader, and the plus and long paths only decode through TCD. seed just seeds the noise for that single sigma-1.0 pass: repeatability, not creativity.

The output

One latent. Wire it into the pack's FlashVSR Decoder, not a generic VAEDecode: the latent also carries the LQ frames, which the decoder uses for wavelet or AdaIN colour correction against the source, plus the padding count it trims. In long_mode the sample is a list of segments and only the TCDecoder path can read it.

Install

Manager, search "FlashVSR" (publisher smthemex), or:

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

That file is torch, einops and imageio - light. The scary Block-Sparse-Attention wheel build in the README is for the alternative quality path, not this sampler's 1.x route.

Weights go in ComfyUI/models/FlashVSR: the DMD DiT (e.g. diffusion_pytorch_model_streaming_dmd.safetensors), LQ_proj_in.ckpt, and posi_prompt.pth. Your VAE goes in ComfyUI/models/vae - plain Wan2.1_VAE works, TCDecoder.ckpt is optional but required for long mode and plus.

Where people get burned

The version combo on the Model loader must match the files: 1.0 uses the buffer projection, 1.1 the causal one, and plus maps turbo↔turbo_dit_plus, base↔base_dit_plus. Mismatched pairs load fine, then produce garbage or a shape error.

Load a plus model and know that this sampler ignores kv_ratio, local_range, sparse_ratio, chunk_q and long_mode - the plus pipeline is a fixed preset and those widgets are dead. It also picks its attention kernel automatically (block-sparse, then flashvsr_attn, then SDPA) with no picker on this node, so watch the console line naming the kernel it got; a fallback to SDPA is slower and looks different.

OOM at the decode rather than the sample is the common one, and it's why the decoder defaults to tiled with a 64-latent tile. Under 24GB, combine tiling with offload and a lower chunk_q, and pay in wall time - tiling cut one 3090 owner to under a third of 24GB for a 2x upscale of 81 frames at 640×880, far slower. That trade is the whole game here.

CategoryFlashVSR

Inputs (12)

NameTypeDefaultDescription
modelFVSRN_MODEL—
imageIMAGE—
widthINT1280128–16384LQ regularised width (nearest-exact resize before x-scale)
heightINT768128–16384LQ regularised height
seedINT00–2147483647—
scaleINT41–4upscale factor: LQ is bicubic-upscaled x scale, centre-cropped to 128-multiple
kv_ratioFLOAT3.50–10—
local_rangeINT111–509 = sharper, 11 = more stable (official recommendation)
sparse_ratioFLOAT2.00–10—
offloadBOOLEANfalseunload the DiT after sampling
chunk_qINT00–8192query-chunk size for the sparse attention (0=auto). Must be a multiple of 128. Lower = less VRAM.
long_modeBOOLEANfalsetiny_long mode: emit per-window latent segments for segmented TCDecoder decoding (long videos); requires tcd_encoder

Outputs (1)

NameTypeDescription
latentLATENT—