- Use generate_draft_block_mask_refined for sparse attention mask (matches
naxci1's generate_draft_block_mask_sage with proper half-block key scoring)
- Remove spurious repeat_interleave(2, dim=-1) from generate_draft_block_mask
that doubled the key dimension incorrectly
- Add torch.clamp(0, 1) to _to_frames output (matches naxci1's tensor2video)
- Add .to(self.device) on LQ video slices in streaming loop for all pipelines
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause of remaining ghosting: our single-stage temporal padding
(N+4 → floor to 8k+1) TRUNCATED frames when N+4 wasn't already 8k+1.
For 50 frames: 50+4=54 → floor to 49, LOSING the last input frame.
The pipeline then processed misaligned LQ→output frame mapping.
Fix matches naxci1/ComfyUI-FlashVSR_Stable two-stage approach:
1. Pad to next_8n5(N) (next integer >= N of form 8k+5, minimum 21)
2. Add 4 → result is always 8(k+1)+1, a valid 8k+1 — NEVER truncates
Also:
- kv_ratio default 2.0→3.0 (matches naxci1, max quality KV cache)
- local_range default 9→11 (more stable temporal consistency)
- sinusoidal_embedding_1d, precompute_freqs_cis, rope_apply: float32→float64
(matches naxci1 reference precision for embeddings and RoPE)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: three critical differences from naxci1 reference implementation:
1. Batch decode after loop → streaming per-chunk TCDecoder decode with LQ
conditioning inside the loop. The TCDecoder uses causal convolutions with
temporal memory that must be built incrementally per-chunk. Batch decode
breaks this design and loses LQ frame conditioning, causing ghosting.
2. Buffer_LQ4x_Proj → Causal_LQ4x_Proj for FlashVSR v1.1. The causal
variant reads the OLD cache before writing the new one (truly causal),
while Buffer writes cache BEFORE the conv call. Using the wrong variant
misaligns temporal LQ conditioning features.
3. Temporal padding formula: changed from round-up to largest_8n1_leq(N+4)
matching the naxci1 reference approach.
Changes:
- flashvsr_full.py: streaming TCDecoder decode per-chunk with LQ conditioning
and per-chunk color correction (was: batch VAE decode after loop)
- flashvsr_tiny.py: streaming TCDecoder decode per-chunk (was: batch decode)
- inference.py: use Causal_LQ4x_Proj, build TCDecoder for ALL modes (including
full), fix temporal padding to largest_8n1_leq(N+4), clear TCDecoder in
clear_caches()
- utils.py: add Causal_LQ4x_Proj class
- nodes.py: update progress bar estimation for new padding formula
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove front dummy frames (not used by reference implementation)
- Use centered reflect padding instead of right/bottom replicate
- Crop output from center matching padding offsets
- Simplify temporal padding to 8k+1 alignment
- Update progress bar estimation to match new formula
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pipeline's LQ conditioning indexing expects 2 front dummy frames
(copies of first frame) as warmup. Our previous refactoring removed
these, shifting all LQ conditioning by 2 frames and causing severe
ghosting artifacts.
Now matches the 1038lab reference preprocessing exactly:
1. _prepare_video: 2 tail copies + alignment + 2 front dummies + back padding
2. _restore_video_sequence: strip first 2 warmup frames + trim to original count
3. Crop pipeline output to padded_n before restoration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pipeline requires num_frames % 4 == 1. Our old _pad_video_5d used a
wrong formula that produced non-conforming counts (e.g. 33 input → 35
padded → pipeline rounds to 37, wasting VRAM).
New padding uses num_frames % 8 == 1 (also satisfies % 4 == 1), which
ensures the streaming loop output exactly matches num_frames with zero
waste. Optimal input counts: 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105.
Also removes incorrect 2-frame warmup stripping from _restore_video_sequence
— the pipeline output doesn't have warmup artifacts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Vendor minimal diffsynth subset for FlashVSR inference (full/tiny pipelines,
v1 and v1.1 checkpoints auto-downloaded from HuggingFace). Includes segment-based
processing with temporal overlap and crossfade blending for bounded RAM on long videos.
Nodes: Load FlashVSR Model, FlashVSR Upscale, FlashVSR Segment Upscale.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrates GIMM-VFI alongside existing BIM/EMA/SGM models. Key feature: generates
all intermediate frames in one forward pass (no recursive 2x passes needed for 4x/8x).
- Vendor gimm_vfi_arch/ from kijai/ComfyUI-GIMM-VFI with device fixes
- Two variants: RAFT-based (~80MB) and FlowFormer-based (~123MB)
- Auto-download checkpoints from HuggingFace (Kijai/GIMM-VFI_safetensors)
- Three new nodes: Load GIMM-VFI Model, GIMM-VFI Interpolate, GIMM-VFI Segment Interpolate
- single_pass toggle: True=arbitrary timestep (default), False=recursive like other models
- ds_factor parameter for high-res input downscaling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update logger names, install prefixes, README clone instructions, and
error messages to reflect the new repo name. Model-specific node names
and categories (BIM-VFI, EMA-VFI, SGM-VFI) are unchanged.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SGM-VFI combines local flow estimation with sparse global matching
(GMFlow) to handle large motion and occlusion-heavy scenes. Adds 3 new
nodes: Load SGM-VFI Model, SGM-VFI Interpolate, SGM-VFI Segment
Interpolate. Architecture files vendored from MCG-NJU/SGM-VFI with
device-awareness fixes (no hardcoded .cuda()), relative imports, and
debug code removed. README updated with model comparison table.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrate EMA-VFI alongside existing BIM-VFI with three new ComfyUI nodes:
Load EMA-VFI Model, EMA-VFI Interpolate, and EMA-VFI Segment Interpolate.
Architecture files vendored from MCG-NJU/EMA-VFI with device-awareness
fixes (removed hardcoded .cuda() calls), warp cache management, and
relative imports. InputPadder extended to support EMA-VFI's replicate
center-symmetric padding. Auto-installs timm dependency on first load.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Processes multiple frame pairs simultaneously instead of one-by-one.
New batch_size input (1-64) lets users trade VRAM for speed.
Refactored pyr_level logic into shared _get_pyr_level() helper.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When enabled (default), automatically picks the optimal pyr_level
based on input height: <540p=3, 540p=5, 1080p=6, 4K=7.
When disabled, uses the manual pyr_level value.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously the user's pyr_level was overridden for >=540p content.
Now the setting is always used, with the tooltip recommending values
per resolution instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wraps BiM-VFI (CVPR 2025) as a ComfyUI custom node for long video
frame interpolation with memory-safe sequential processing.
- LoadBIMVFIModel: checkpoint loader with auto-download from Google Drive
- BIMVFIInterpolate: 2x/4x/8x recursive interpolation with per-pair
GPU processing, configurable VRAM management (all_on_gpu for high-VRAM
setups), progress bar, and backwarp cache clearing
- Vendored inference-only architecture from KAIST-VICLab/BiM-VFI
- Auto-detection of CUDA version for cupy installation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>