Nodes/ComfyUI_SparkVSR_SM/SparkVSR_SM_KSampler
ComfyUI Node

SparkVSR_SM_KSampler

Where SparkVSR does the work (and eats your VRAM)

By smthemex·Created 5 months ago·Updated 5 months ago· 39
SparkVSR_SM_KSampler
  • model
  • conds
  • images
seed0
overlap_t8
chunk_len0
overlap_hw
tile_size_hw
noise_step0
sr_noise_step399
ref_guidance_scale1.0
offloadtrue
num_blocks_per_group1

SparkVSR_SM_KSampler is where SparkVSR actually happens. The other two nodes in the pack are setup - this one loads the model, that one builds the conditioning - and this one runs the super-resolution pass over your video and hands you back frames. It's also the node that decides whether the job finishes in minutes on your card or doesn't finish at all.

How it works

It takes the MODEL from SparkVSR_SM_Model and the CONDITIONING from SparkVSR_SM_PreRefer, encodes the upscaled video into latent space, and injects the reference-frame latents at their keyframe positions. Then it runs a single diffusion step at a high timestep through the CogVideoX transformer - sr_noise_step defaults to 399, near max, which means full regeneration - and decodes the result back to pixels.

The clever part is how it fits a 20GB model on a reasonable card: it splits the work in time and space. chunk_len slices the video into frame-chunks (with overlap_t frames of temporal overlap so seams don't show), and tile_size_hw slices each frame into spatial tiles (with overlap_hw of overlap). Each chunk/tile gets its own single pass, and the valid regions are stitched back together. When offload is on, it uses diffusers' block-level group offloading to shuffle transformer blocks between GPU and RAM as needed. Total work = time_chunks × spatial_tiles, which is why a long 4K clip is still a long night even though each step is fast.

The output is a batch of IMAGE frames - wire it into a SaveVideo / CreateVideo node from your usual video node pack.

The inputs that matter

  • model and conds - wired from the other two nodes; you basically never touch them.
  • seed - for reproducible runs.
  • tile_size_hw - (0,0) means whole frame at once. If you OOM, go 512×512 or 768×768. This is the single biggest VRAM lever, and it's exactly what the README means when it says to adjust the tile values for very large videos.
  • chunk_len - 0 processes the whole video in one time-chunk. For long clips set something like 32–64 frames; it must be greater than overlap_t (default 8), or it errors.
  • sr_noise_step - the timestep of the SR pass (default 399). Lower it if the output drifts too far from your source; keep it high for maximal regeneration.
  • noise_step - 0 means don't pre-noise the low-quality latent. Usually leave it at 0; it's a knob for the brave.
  • ref_guidance_scale - 1.0 disables CFG. Raise it toward 1.5–2 to make the model cling harder to your reference frames.
  • offload and num_blocks_per_group - keep offload on unless you have a 48GB+ card; num_blocks_per_group=1 is the most aggressive memory saving.

Installing it

Nothing extra to download for this node - the weights all live in SparkVSR_SM_Model. The pack itself installs via ComfyUI Manager (search "ComfyUI_SparkVSR_SM") or:

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

Restart, and keep in mind the heavy dependency list (diffusers, SwissArmyTransformer, moviepy, decord, av) is where installs usually go sideways.

Common issues

  • Out of memory - turn on spatial tiling first, then chunk the time dimension. bf16/GGUF on the loader side also helps enormously.
  • "chunk_len must be greater than overlap" - you set chunk_len below overlap_t. Raise chunk_len.
  • "Reference frame interval must be > 3" - that error actually comes from SparkVSR_SM_PreRefer's keyframes being spaced too tightly, so fix it there, not here.
  • Garbage or empty output - check that the model actually loaded (see SparkVSR_SM_Model) and that conds contains references; no-reference mode is a visible quality step down.
CategorySparkVSR_SM

Inputs (12)

NameTypeDefaultDescription
modelMODEL
condsCONDITIONING
seedINT00–2147483647
overlap_tINT80–16384
chunk_lenINT00–16384
overlap_hwCOMBO4 options: 32,32, 48,48, 64,64, 96,96
tile_size_hwCOMBO8 options: 0,0, 48,48, 64,64, 128,128, 256,256, 512,512, +2
noise_stepINT00–16384
sr_noise_stepINT3991–16384
ref_guidance_scaleFLOAT1.00–100
offloadBOOLEANtrue
num_blocks_per_groupINT11–64

Outputs (1)

NameTypeDescription
imagesIMAGE