[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72473":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},72473,"ComfyUI-SeedVR2_VideoUpscaler","numz\u002FComfyUI-SeedVR2_VideoUpscaler","numz","Official SeedVR2 Video Upscaler for ComfyUI","",null,"Python",2529,195,27,120,0,14,38,95,42,28.88,"Apache License 2.0",false,"main",true,[27,28,29,30,31],"ai","comfyui","comfyui-nodes","upscaler","video-processing","2026-06-12 02:03:03","# ComfyUI-SeedVR2_VideoUpscaler\n\n[![View Code](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F📂_View_Code-GitHub-181717?style=for-the-badge&logo=github)](https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler)\n\nOfficial release of [SeedVR2](https:\u002F\u002Fgithub.com\u002FByteDance-Seed\u002FSeedVR) for ComfyUI that enables high-quality video and image upscaling.\n\nCan run as **Multi-GPU standalone CLI** too, see [🖥️ Run as Standalone](#-run-as-standalone-cli) section.\n\n[![SeedVR2 v2.5 Deep Dive Tutorial](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FMBtWYXq_r60\u002Fmaxresdefault.jpg)](https:\u002F\u002Fyoutu.be\u002FMBtWYXq_r60)\n\n![Usage Example](docs\u002Fusage_01.png)\n\n![Usage Example](docs\u002Fusage_02.png)\n\n## 📋 Quick Access\n\n- [🆙 Future Work](#-future-work)\n- [🚀 Release Notes](#-release-notes)\n- [🎯 Features](#-features)\n- [🔧 Requirements](#-requirements)\n- [📦 Installation](#-installation)\n- [📖 Usage](#-usage)\n- [🖥️ Run as Standalone](#️-run-as-standalone-cli)\n- [⚠️ Limitations](#️-limitations)\n- [🤝 Contributing](#-contributing)\n- [🙏 Credits](#-credits)\n- [📜 License](#-license)\n\n## 🆙 Future Work\n\nWe're actively working on improvements and new features. To stay informed:\n\n- **📌 Track Active Development**: Visit [Issues](https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler\u002Fissues) to see active development, report bugs, and request new features\n- **💬 Join the Community**: Learn from others, share your workflows, and get help in the [Discussions](https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler\u002Fdiscussions)\n- **🔮 Next Model Survey**: We're looking for community input on the next open-source super-powerful generic restoration model. Share your suggestions in [Issue #164](https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler\u002Fissues\u002F164)\n\n## 🚀 Release Notes\n\n**2025.12.24 - Version 2.5.24**\n\n- **🍎 Fix: MPS memory leak regression** - Restored MPS cache clearing after VAE encode\u002Fdecode operations that was accidentally removed during code cleanup in v2.5.23\n\n**2025.12.24 - Version 2.5.23**\n\n- **🔒 Security: Prevent code execution in model loading** - Added protection against malicious .pth files by restricting deserialization to tensors only\n- **🎥 Fix: FFmpeg video writer reliability** - Resolved ffmpeg process hanging issues by redirecting stderr and adding buffer flush, with improved error messages for debugging *(thanks [@thehhmdb](https:\u002F\u002Fgithub.com\u002Fthehhmdb))*\n- **⚡ Fix: GGUF VAE model support** - Enabled automatic weight dequantization for convolution operations, making GGUF-quantized VAE models fully functional *(thanks [@naxci1](https:\u002F\u002Fgithub.com\u002Fnaxci1))*\n- **🛡️ Fix: VAE slicing edge cases** - Protected against division by zero crashes when using small split sizes with high temporal downsampling *(thanks [@naxci1](https:\u002F\u002Fgithub.com\u002Fnaxci1))*\n- **🎨 Fix: LAB color transfer precision** - Resolved dtype mismatch errors during video upscaling by ensuring consistent float types before matrix operations\n- **🔧 Fix: PyTorch 2.9+ compatibility** - Extended Conv3d memory workaround to all PyTorch 2.9+ versions, fixing 3x VRAM usage on newer PyTorch releases\n- **📦 Fix: Bitsandbytes compatibility** - Added ValueError exception handling for Intel Gaudi version detection failures on non-Gaudi systems\n- **🍎 MPS: Memory optimization** - Reduced memory usage during encode\u002Fdecode operations on Apple Silicon *(thanks [@s-cerevisiae](https:\u002F\u002Fgithub.com\u002Fs-cerevisiae))*\n\n\n**2025.12.13 - Version 2.5.22**\n\n- **🎬 CLI: FFmpeg video backend with 10-bit support** - New `--video_backend ffmpeg` and `--10bit` flags enable x265 encoding with 10-bit color depth, reducing banding artifacts in gradients compared to 8-bit OpenCV output *(based on PR by [@thehhmdb](https:\u002F\u002Fgithub.com\u002Fthehhmdb) - thank you!)*\n- **🍎 Fix: MPS bicubic upscaling compatibility** - Added CPU fallback for bicubic+antialias interpolation on PyTorch versions before 2.8.0, resolving RGBA alpha upscaling errors on Apple Silicon\n- **⚡ Fix: Cross-platform histogram matching** - Replaced scatter_ operation with argsort+index_select for improved reliability across CUDA, ROCm, and MPS backends\n- **🧹 MPS: Remove sync overhead** - Reverted unnecessary `torch.mps.synchronize()` calls introduced in v2.5.21 for consistent behavior with CUDA pipeline\n\n**2025.12.12 - Version 2.5.21**\n\n- **🛠️ Fix: GGUF dequantization error on MPS** - Resolved shape mismatch error introduced in 2.5.20 by skipping GGUF quantized buffers in precision conversion - these must remain in packed format for on-the-fly dequantization during inference\n- **🍎 MPS: Eliminate CPU sync overhead** - Skip unnecessary CPU tensor offload on Apple Silicon unified memory architecture, preventing sync stalls that caused slowdowns. Input images and output video now stay on MPS device throughout the pipeline\n- **⚡ MPS: Preload text embeddings** - Load text embeddings before Phase 1 encoding to avoid sync stall at Phase 2 start, improving timing accuracy and throughput\n- **🧹 MPS: Optimized model cleanup** - Skip redundant CPU movement before model deletion on unified memory\n\n**2025.12.12 - Version 2.5.20**\n\n- **⚡ Expanded attention backends** - Full support for Flash Attention 2 (Ampere+), Flash Attention 3 (Hopper+), SageAttention 2, and SageAttention 3 (Blackwell\u002FRTX 50xx), with automatic fallback chains to PyTorch SDPA when unavailable *(based on PR by [@naxci1](https:\u002F\u002Fgithub.com\u002Fnaxci1) - thank you!)*\n- **🍎 macOS\u002FApple Silicon compatibility** - Replaced MPS autocast with explicit dtype conversion throughout VAE and DiT pipelines, resolving hangs and crashes on M-series Macs. BlockSwap now auto-disables with warning (unified memory makes it meaningless)\n- **🛡️ Flash Attention graceful fallback** - Added compatibility shims for corrupted or partially installed flash_attn\u002Fxformers DLLs, preventing startup crashes\n- **🛡️ AMD ROCm: bitsandbytes conflict fix** - Prevent kernel registration errors when diffusers attempts to re-import broken bitsandbytes installations\n- **📦 ComfyUI Manager: macOS classifier fix** - Removed NVIDIA CUDA classifier causing false \"GPU not supported\" warnings on macOS\n- **📚 Documentation updates** - Updated README with attention backend details, BlockSwap macOS notes, and clarified model caching descriptions\n\n**2025.12.10 - Version 2.5.19**\n\n- **🎨 New header logo design** - Refreshed ASCII art banner *(thanks [@naxci1](https:\u002F\u002Fgithub.com\u002Fnaxci1))*\n- **🧹 Remove dead flash attention wrapper** - Removed legacy code from FP8CompatibleDiT; FlashAttentionVarlen already handles backend switching via its `attention_mode` attribute\n- **🛡️ Fix graceful fallback from flash-attn** - Add compatibility shims for corrupted flash_attn\u002Fxformers DLLs, preventing startup crashes when CUDA extensions are broken\n- **📊 Improved VRAM tracking** - Separate allocated vs reserved memory tracking, Windows-only overflow detection (WDDM paging behavior)\n- **♻️ Centralize backend detection** - Unified `is_mps_available()`, `is_cuda_available()`, `get_gpu_backend()` helpers across codebase\n- **🔄 Revert 2.5.14 VRAM limit enforcement** - Removed `set_per_process_memory_fraction` call; Overflow detection and warnings remain.\n\n**2025.12.09 - Version 2.5.18**\n\n- **🚀 CLI: Streaming mode for long videos** - New `--chunk_size` flag processes videos in memory-bounded chunks, enabling arbitrarily long videos without RAM limits. Works with model caching (`--cache_dit`\u002F`--cache_vae`) for chunk-to-chunk reuse *(inspired by [disk02](https:\u002F\u002Fgithub.com\u002Fdisk02) PR contribution)*\n- **⚡ CLI: Multi-GPU streaming** - Each GPU now streams its segment internally with independent model caching, improving memory efficiency and enabling `--temporal_overlap` blending at GPU boundaries\n- **🔧 CLI: Fix large video MemoryError** - Shared memory transfer replaces numpy pickling, preventing crashes on high-resolution\u002Flong video outputs *(inspired by  [FurkanGozukara](https:\u002F\u002Fgithub.com\u002FFurkanGozukara) PR contribution)*\n\n**2025.12.05 - Version 2.5.17**\n\n- **🔧 Fix: Older GPU compatibility (GTX 970, etc.)** - Runtime bf16 CUBLAS probe replaces compute capability heuristics, correctly detecting unsupported GPUs without affecting RTX 20XX\n\n**2025.12.05 - Version 2.5.16**\n\n- **🔧 Fix: Older GPU compatibility (GTX 970, etc.)** - Automatic fallback for GPUs without bfloat16 support\n- **🐛 Fix: Quality regression** - Reverted bfloat16 detection that was causing artifact issues\n- **📋 Debug: Environment info display** - Shows system info in debug mode to help with issue reporting\n- **📚 Docs: Simplified contribution workflow** - Streamlined to main branch only\n\n**2025.12.03 - Version 2.5.15**\n\n- **🍎 Fix: MPS compatibility** - Disable antialias for MPS tensors and fix bfloat16 arange issues\n- **⚡ Fix: Autocast device type** - Use proper device type attribute to prevent autocast errors\n- **📊 Memory: Accurate VRAM tracking** - Use max_memory_reserved for more precise peak reporting\n- **🔧 Fix: Triton compatibility** - Add shim for bitsandbytes 0.45+ \u002F triton 3.0+ (fixes PyTorch 2.7 installation errors)\n\n**2025.12.01 - Version 2.5.14**\n\n- **🍎 Fix: MPS device comparison** - Normalize device strings to prevent unnecessary tensor movements\n- **📊 Memory: VRAM swap detection** - Peak stats now show GPU+swap breakdown when overflow occurs, with warning when swap detected\n- **🛡️ Memory: Enforce physical VRAM limit** - PyTorch now OOMs instead of silently swapping to shared memory (prevents extreme slowdowns on Windows)\n\n**2025.11.30 - Version 2.5.13**\n\n- **🔧 Fix: PyTorch 2.7+ triton import error** - Resolved installation crash caused by triton.ops import chain on newer triton versions\n- **💾 Fix: OOM on float32 conversion for long videos** - Graceful fallback to native dtype when insufficient memory for float32 conversion\n- **🍎 Fix: CLI watermark error on macOS** - Resolved MPS-related watermark processing crash on Apple Silicon\n\n**2025.11.28 - Version 2.5.12**\n\n- **🐛 Fix: Color artifacts regression** - Reverted in-place tensor operations in video transform pipeline that caused color artifacts on some images\n\n**2025.11.28 - Version 2.5.11**\n\n- **⚡ Feature: CUDNN attention backend** - Added support for PyTorch 2.3+ CUDNN_ATTENTION backend with automatic fallback for older versions (thanks @eadwu)\n- **💾 Fix: Memory spike for long videos** - VAE decode now streams directly to pre-allocated tensor, eliminating OOM errors during long video processing\n- **🎨 Fix: LAB color correction artifacts** - Resolved tile boundary artifacts using wavelet reconstruction preprocessing\n- **🎨 Fix: Color reference misalignment** - Fixed color correction frame alignment with temporal overlap\n- **🍎 Fix: MPS detection reliability** - Switched to canonical `torch.backends.mps.is_available()` API for consistent Apple Silicon detection\n- **🖥️ Fix: Mac subprocess error** - CLI now uses direct processing on Mac to avoid MPS allocator failures in child processes\n- **🖥️ Fix: Multi-GPU device assignment** - CUDA_VISIBLE_DEVICES now set before spawn for proper worker inheritance\n- **📊 Fix: BlockSwap logging** - Now shows effective\u002Ftotal blocks (e.g., 32\u002F32) instead of raw requested value\n- **🔧 Feature: Auto bfloat16 detection** - Automatically detects bfloat16 support to prevent CUBLAS errors on older GPUs\n- **📊 Feature: Peak RAM tracking** - Added RAM usage alongside VRAM in debug summary\n- **⚡ Performance: In-place tensor ops** - Reduced memory allocation overhead with in-place operations throughout pipeline\n- **📖 Docs: Multi-GPU clarification** - Clarified frame-level parallelism behavior expectations for multi-GPU setups\n\n**2025.11.13 - Version 2.5.10**\n\n- **🎯 Fix: Deterministic generation** - Identical images with the same seed now produce identical results across different sessions and batch positions\n- **🔧 Fix: Model caching with BlockSwap** - Resolved issue where cached DiT models wouldn't properly reload when VAE caching state changed\n- **💾 Fix: Runner caching optimization** - Runner templates now correctly cache whenever both DiT and VAE are cached, regardless of caching order\n- **📁 Fix: Case-insensitive model paths** - Extra model paths in YAML config now work regardless of case (seedvr2, SEEDVR2, SeedVR2, etc.)\n- **🐛 Fix: High resolution tile debug crash** - Fixed \"NoneType has no attribute log\" error when using maximum resolution with VAE tiling\n- **📊 Fix: Temporal overlap logging** - Corrected frame count reporting when temporal overlap is automatically adjusted\n- **🔍 Feature: Enhanced model path debugging** - Added detailed logging to help troubleshoot model loading issues (visible in debug mode)\n\n**2025.11.12 - Version 2.5.9**\n\n- **🐛 Fix: Tile debug visualization crash** - Fixed OpenCV error when using VAE tile debug mode on certain systems.\n- **🍎 Fix: macOS MPS loading error** - Added automatic CPU fallback for MPS allocator issues on certain PyTorch\u002FmacOS versions.\n- **🖥️ Fix: Windows log buffering** - Added flush to print statements for real-time log visibility in ComfyUI on Windows\n- **📦 Fix: ComfyUI Registry logo** - Updated icon URL to display properly in ComfyUI node registry\n- **ℹ️ Feature: Version display** - Added version number to node name and CLI\u002FComfyUI header for better tracking\n- **💝 Feature: GitHub Sponsors** - Added sponsor button to support project development. Thank you everyone for your support!\n- **📜 License: Apache 2.0** - Reverted License from MIT to Apache 2.0 to match ByteDance Seed project\n\n**2025.11.10 - Version 2.5.8**\n\n- **🐛 Fix (CLI): Windows batch processing duplicate files** - Fixed CLI batch mode processing each file twice on Windows due to case-insensitive filesystem. Improved directory scanning performance by 2-3x\n- **📁 Fix(CLI): Output folder location** - Output files now created in sensible locations: batch mode creates `{folder_name}_upscaled\u002F` sibling folder with original filenames preserved; single file mode adds `_upscaled` suffix in same directory. All logs now show absolute paths for clarity\n- **🎨 Fix(CLI): RGBA alpha channel support** - PNG images with transparency are now properly detected and preserved through the upscaling pipeline, matching ComfyUI behavior\n\n**2025.11.10 - Version 2.5.7**\n\n- **🔧 Fix: Conv3d workaround compatibility** - Enhanced platform detection and added graceful fallback to prevent errors on PyTorch dev builds and AMD ROCm systems\n\n**2025.11.09 - Version 2.5.6**\n\n- 🎨 **Fix: Restored natural look for 7b model** - Corrected torch.compile optimization that was causing overly plastic\u002F high-specular appearance in upscaled videos with 7b model.\n\n- 💾 **Memory: Fixed RAM leak for long videos** - On-demand reconstruction with lightweight batch indices instead of storing full transformed videos, fixed release_tensor_memory to handle CPU\u002FCUDA\u002FMPS consistently, and refactored batch processing helpers\n\n**2025.11.08 - Version 2.5.4**\n\n- 🎨 **Fix: AdaIN color correction** - Replace `.view()` with `.reshape()` to handle non-contiguous tensors after spatial padding, resolving \"view size is not compatible with input tensor's size and stride\" error\n- 🔴 **Fix: AMD ROCm compatibility** - Add cuDNN availability check in Conv3d workaround to prevent \"ATen not compiled with cuDNN support\" error on ROCm systems (AMD GPUs on Windows\u002FLinux)\n\n**2025.11.08 - Version 2.5.3**\n\n- 🍎 **Fix: Apple Silicon MPS device handling** - Corrected MPS device enumeration to use `\"mps\"` instead of `\"mps:0\"`, resolving invalid device errors on M-series Macs\n- 🪟 **Fix: torch.mps AttributeError on Windows** - Add defensive checks for `torch.mps.is_available()` to handle PyTorch versions where the method doesn't exist on non-Mac platforms\n\n**2025.11.07 - Version 2.5.0** 🎉\n\n⚠️ **BREAKING CHANGE**: This is a major update requiring workflow recreation. All nodes and CLI parameters have been redesigned for better usability and consistency. Watch the latest video from [AInVFX](https:\u002F\u002Fwww.youtube.com\u002F@AInVFX) for a deep dive and check out the [usage](#-usage) section.\n\n**📦 Official Release**: Now available on main branch with ComfyUI Manager support for easy installation and automatic version tracking. Updated dependencies and local imports prevent conflicts with other ComfyUI custom nodes.\n\n### 🎨 ComfyUI Improvements\n\n- **Four-Node Modular Architecture**: Split into dedicated nodes for DiT model, VAE model, torch.compile settings, and main upscaler for granular control\n- **Global Model Cache**: Models now shared across multiple upscaler instances with automatic config updates - no more redundant loading\n- **ComfyUI V3 Migration**: Full compatibility with ComfyUI V3 stateless node design\n- **RGBA Support**: Native alpha channel processing with edge-guided upscaling for clean transparency\n- **Improved Memory Management**: Streaming architecture prevents VRAM spikes regardless of video length\n- **Flexible Resolution Support**: Upscale to any resolution divisible by 2 with lossless padding approach (replaced restrictive cropping)\n- **Enhanced Parameters**: Added `uniform_batch_size`, `temporal_overlap`, `prepend_frames`, and `max_resolution` for better control\n\n### 🖥️ CLI Enhancements\n\n- **Batch Directory Processing**: Process entire folders of videos\u002Fimages with model caching for efficiency\n- **Single Image Support**: Direct image upscaling without video conversion\n- **Smart Output Detection**: Auto-detects output format (MP4\u002FPNG) based on input type\n- **Enhanced Multi-GPU**: Improved workload distribution with temporal overlap blending\n- **Unified Parameters**: CLI and ComfyUI now use identical parameter names for consistency\n- **Better UX**: Auto-display help, validation improvements, progress tracking, and cleaner output\n\n### ⚡ Performance & Optimization\n\n- **torch.compile Support**: 20-40% DiT speedup and 15-25% VAE speedup with full graph compilation\n- **Optimized BlockSwap**: Adaptive memory clearing (5% threshold), separate I\u002FO component handling, reduced overhead\n- **Enhanced VAE Tiling**: Tensor offload support for accumulation buffers, separate encode\u002Fdecode configuration\n- **Native Dtype Pipeline**: Eliminated unnecessary conversions, maintains bfloat16 precision throughout for speed and quality\n- **Optimized Tensor Operations**: Replaced einops rearrange with native PyTorch ops for 2-5x faster transforms\n\n### 🎯 Quality Improvements\n\n- **LAB Color Correction**: New perceptual color transfer method with superior color accuracy (now default)\n- **Additional Color Methods**: HSV saturation matching, wavelet adaptive, and hybrid approaches\n- **Deterministic Generation**: Seed-based reproducibility with phase-specific seeding strategy\n- **Better Temporal Consistency**: Hann window blending for smooth transitions between batches\n\n### 💾 Memory Management\n\n- **Smarter Offloading**: Independent device configuration for DiT, VAE, and tensors (CPU\u002FGPU\u002Fnone)\n- **Four-Phase Pipeline**: Completes each phase (encode→upscale→decode→postprocess) for all batches before moving to next, minimizing model swaps\n- **Better Cleanup**: Phase-specific resource management with proper tensor memory release\n- **Peak VRAM Tracking**: Per-phase memory monitoring with summary display\n\n### 🔧 Technical Improvements\n\n- **GGUF Quantization Support**: Added full GGUF support for 4-bit\u002F8-bit inference on low-VRAM systems\n- **Improved GGUF Handling**: Fixed VRAM leaks, torch.compile compatibility, non-persistent buffers\n- **Apple Silicon Support**: Full MPS (Metal Performance Shaders) support for Apple Silicon Macs\n- **AMD ROCm Compatibility**: Conditional FSDP imports for PyTorch ROCm 7+ support\n- **Conv3d Memory Workaround**: Fixes PyTorch 2.9+ cuDNN memory bug (3x usage reduction)\n- **Flash Attention Optional**: Graceful fallback to SDPA when flash-attn unavailable\n\n### 📚 Code Quality\n\n- **Modular Architecture**: Split monolithic files into focused modules (generation_phases, model_configuration, etc.)\n- **Comprehensive Documentation**: Extensive docstrings with type hints across all modules\n- **Better Error Handling**: Early validation, clear error messages, installation instructions\n- **Consistent Logging**: Unified indentation, better categorization, concise messages\n\n**2025.08.07**\n\n- 🎯 **Unified Debug System**: New structured logging with categories, timers, and memory tracking. `enable_debug` now available on main node\n- ⚡ **Smart FP8 Optimization**: FP8 models now keep native FP8 storage, converting to BFloat16 only for arithmetic - faster and more memory efficient than FP16\n- 📦 **Model Registry**: Multi-repo support (numz\u002F & AInVFX\u002F), auto-discovery of user models, added mixed FP8 variants to fix 7B artifacts\n- 💾 **Model Caching**: `cache_model` moved to main node, fixed memory leaks with proper RoPE\u002Fwrapper cleanup\n- 🧹 **Code Cleanup**: New modular structure (`constants.py`, `model_registry.py`, `debug.py`), removed legacy code\n- 🚀 **Performance**: Better memory management with `torch.cuda.ipc_collect()`, improved RoPE handling\n\n**2025.07.17**\n\n- 🛠️ Add 7B sharp Models: add 2 new 7B models with sharpen output\n\n**2025.07.11**\n\n- 🎬 Complete tutorial released: Adrien from [AInVFX](https:\u002F\u002Fwww.youtube.com\u002F@AInVFX) created an in-depth ComfyUI SeedVR2 guide covering everything from basic setup to advanced BlockSwap techniques for running on consumer GPUs. Perfect for understanding memory optimization and upscaling of image sequences with alpha channel! [Watch the tutorial](#-usage)\n\n**2025.09.07**\n\n- 🛠️ Blockswap Integration: Big thanks to [Adrien Toupet](https:\u002F\u002Fgithub.com\u002Fadrientoupet) from [AInVFX](https:\u002F\u002Fwww.youtube.com\u002F@AInVFX) for this :), useful for low VRAM users (see [usage](#-usage) section)\n\n**2025.07.03**\n\n- 🛠️ Can run as **standalone mode** with **Multi GPU** see [🖥️ Run as Standalone](#run-as-standalone-cli)\n\n**2025.06.30**\n\n- 🚀 Speed Up the process and less VRAM used\n- 🛠️ Fixed memory leak on 3B models\n- ❌ Can now interrupt process if needed\n- ✅ Refactored the code for better sharing with the community, feel free to propose pull requests\n- 🛠️ Removed flash attention dependency (thanks to [luke2642](https:\u002F\u002Fgithub.com\u002FLuke2642) !!)\n\n**2025.06.24**\n\n- 🚀 Speed up the process until x4\n\n**2025.06.22**\n\n- 💪 FP8 compatibility !\n- 🚀 Speed Up all Process\n- 🚀 less VRAM consumption (Stay high, batch_size=1 for RTX4090 max, I'm trying to fix that)\n- 🛠️ Better benchmark coming soon\n\n**2025.06.20**\n\n- 🛠️ Initial push\n\n## 🎯 Features\n\n### Core Capabilities\n- **High-Quality Diffusion-Based Upscaling**: One-step diffusion model for video and image enhancement\n- **Temporal Consistency**: Maintains coherence across video frames with configurable batch processing\n- **Multi-Format Support**: Handles RGB and RGBA (alpha channel) for both videos and images\n- **Any Video Length**: Suitable for any video length\n\n### Model Support\n- **Multiple Model Variants**: 3B and 7B parameter models with different precision options\n- **FP16, FP8, and GGUF Quantization**: Choose between full precision (FP16), mixed precision (FP8), or heavily quantized GGUF models for different VRAM requirements\n- **Automatic Model Downloads**: Models are automatically downloaded from HuggingFace on first use\n\n### Memory Optimization\n- **BlockSwap Technology**: Dynamically swap transformer blocks between GPU and CPU memory to run large models on limited VRAM\n- **VAE Tiling**: Process large resolutions with tiled encoding\u002Fdecoding to reduce VRAM usage\n- **Intelligent Offloading**: Offload models and intermediate tensors to CPU or secondary GPUs between processing phases\n- **GGUF Quantization Support**: Run models with 4-bit or 8-bit quantization for extreme VRAM savings\n\n### Performance Features\n- **torch.compile Integration**: Optional 20-40% DiT speedup and 15-25% VAE speedup with PyTorch 2.0+ compilation\n- **Multi-GPU CLI**: Distribute workload across multiple GPUs with automatic temporal overlap blending\n- **Model Caching**: Keep models loaded between generations for single-GPU directory processing or multi-GPU streaming\n- **Flexible Attention Backends**: Choose between PyTorch SDPA (stable, always available), Flash Attention 2\u002F3, or SageAttention 2\u002F3 for faster computation on supported hardware\n\n### Quality Control\n- **Advanced Color Correction**: Five methods including LAB (recommended for highest fidelity), wavelet, wavelet adaptive, HSV, and AdaIN\n- **Noise Injection Controls**: Fine-tune input and latent noise scales for artifact reduction at high resolutions\n- **Configurable Resolution Limits**: Set target and maximum resolutions with automatic aspect ratio preservation\n\n### Workflow Features\n- **ComfyUI Integration**: Four dedicated nodes for complete control over the upscaling pipeline\n- **Standalone CLI**: Command-line interface for batch processing and automation\n- **Debug Logging**: Comprehensive debug mode with memory tracking, timing information, and processing details\n- **Progress Reporting**: Real-time progress updates during processing\n\n## 🔧 Requirements\n\n### Hardware\n\nWith the current optimizations (tiling, BlockSwap, GGUF quantization), SeedVR2 can run on a wide range of hardware:\n\n- **Minimal VRAM** (8GB or less): Use GGUF Q4_K_M models with BlockSwap and VAE tiling enabled\n- **Moderate VRAM** (12-16GB): Use FP8 models with BlockSwap or VAE tiling as needed\n- **High VRAM** (24GB+): Use FP16 models for best quality and speed without memory optimizations\n\n### Software\n\n- **ComfyUI**: Latest version recommended\n- **Python**: 3.12+ (Python 3.12 and 3.13 tested and recommended)\n- **PyTorch**: 2.0+ for torch.compile support (optional but recommended)\n- **Triton**: Required for torch.compile with inductor backend (optional)\n- **Flash Attention \u002F SageAttention**: Flash Attention 2 (Ampere+), Flash Attention 3 (Hopper+), SageAttention 2 or SageAttention 3 (Blackwell) provide faster attention computation on supported hardware (optional, falls back to PyTorch SDPA)\n\n## 📦 Installation\n\n### Option 1: ComfyUI Manager (Recommended)\n\n1. Open ComfyUI Manager in your ComfyUI interface\n2. Click \"Custom Nodes Manager\"\n3. Search for \"ComfyUI-SeedVR2_VideoUpscaler\"\n4. Click \"Install\" and restart ComfyUI\n\n**Registry Link**: [ComfyUI Registry - SeedVR2 Video Upscaler](https:\u002F\u002Fregistry.comfy.org\u002Fnodes\u002Fseedvr2_videoupscaler)\n\n### Option 2: Manual Installation\n\n1. **Clone the repository** into your ComfyUI custom nodes directory:\n```bash\ncd ComfyUI\ngit clone https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler.git custom_nodes\u002Fseedvr2_videoupscaler\n```\n\n2. **Install dependencies using standalone Python**:\n```bash\n# Install requirements (from same ComfyUI directory)\n# Windows:\n.venv\\Scripts\\python.exe -m pip install -r custom_nodes\\seedvr2_videoupscaler\\requirements.txt\n# Linux\u002FmacOS:\n.venv\u002Fbin\u002Fpython -m pip install -r custom_nodes\u002Fseedvr2_videoupscaler\u002Frequirements.txt\n```\n\n3. **Restart ComfyUI**\n\n### Model Installation\n\nModels will be **automatically downloaded** on first use and saved to `ComfyUI\u002Fmodels\u002FSEEDVR2`.\n\nYou can also manually download models from:\n- Main models available at [numz\u002FSeedVR2_comfyUI](https:\u002F\u002Fhuggingface.co\u002Fnumz\u002FSeedVR2_comfyUI\u002Ftree\u002Fmain) and [AInVFX\u002FSeedVR2_comfyUI](https:\u002F\u002Fhuggingface.co\u002FAInVFX\u002FSeedVR2_comfyUI\u002Ftree\u002Fmain)\n- Additional GGUF models available at [cmeka\u002FSeedVR2-GGUF](https:\u002F\u002Fhuggingface.co\u002Fcmeka\u002FSeedVR2-GGUF\u002Ftree\u002Fmain)\n\n## 📖 Usage\n\n### 🎬 Video Tutorials\n\n#### Latest Version Deep Dive (Recommended)\n\nComplete walkthrough of version 2.5 by Adrien from [AInVFX](https:\u002F\u002Fwww.youtube.com\u002F@AInVFX), covering the new 4-node architecture, GGUF support, memory optimizations, and production workflows:\n\n[![SeedVR2 v2.5 Deep Dive Tutorial](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FMBtWYXq_r60\u002Fmaxresdefault.jpg)](https:\u002F\u002Fyoutu.be\u002FMBtWYXq_r60)\n\nThis comprehensive tutorial covers:\n- Installing v2.5 through ComfyUI Manager and troubleshooting conflicts\n- Understanding the new 4-node modular architecture and why we rebuilt it\n- Running 7B models on 8GB VRAM with GGUF quantization\n- Configuring BlockSwap, VAE tiling, and torch.compile for your hardware\n- Image and video upscaling workflows with alpha channel support\n- CLI for batch processing and multi-GPU rendering\n- Memory optimization strategies for different VRAM levels\n- Real production tips and the critical batch_size formula (4n+1)\n\n#### Previous Version Tutorial\n\nFor reference, here's the original tutorial covering the initial release:\n\n[![SeedVR2 Deep Dive Tutorial](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FI0sl45GMqNg\u002Fmaxresdefault.jpg)](https:\u002F\u002Fyoutu.be\u002FI0sl45GMqNg)\n\n*Note: This tutorial covers the previous single-node architecture. While the UI has changed significantly in v2.5, the core concepts about BlockSwap and memory management remain valuable.*\n\n### Node Setup\n\nSeedVR2 uses a modular node architecture with four specialized nodes:\n\n#### 1. SeedVR2 (Down)Load DiT Model\n\n![SeedVR2 (Down)Load DiT Model](docs\u002Fdit_model_loader.png)\n\nConfigure the DiT (Diffusion Transformer) model for video upscaling.\n\n**Parameters:**\n\n- **model**: Choose your DiT model\n  - **3B Models**: Faster, lower VRAM requirements\n    - `seedvr2_ema_3b_fp16.safetensors`: FP16 (best quality)\n    - `seedvr2_ema_3b_fp8_e4m3fn.safetensors`: FP8 8-bit (good quality)\n    - `seedvr2_ema_3b-Q4_K_M.gguf`: GGUF 4-bit quantized (acceptable quality)\n    - `seedvr2_ema_3b-Q8_0.gguf`: GGUF 8-bit quantized (good quality)\n  - **7B Models**: Higher quality, higher VRAM requirements\n    - `seedvr2_ema_7b_fp16.safetensors`: FP16 (best quality)\n    - `seedvr2_ema_7b_fp8_e4m3fn_mixed_block35_fp16.safetensors`: FP8 with last block in FP16 to reduce artifacts (good quality)\n    - `seedvr2_ema_7b-Q4_K_M.gguf`: GGUF 4-bit quantized (acceptable quality)\n    - `seedvr2_ema_7b_sharp_*`: Sharp variants for enhanced detail\n\n- **device**: GPU device for DiT inference (e.g., `cuda:0`)\n\n- **offload_device**: Device to offload DiT model when not actively processing\n  - `none`: Keep model on inference device (fastest, highest VRAM)\n  - `cpu`: Offload to system RAM (reduces VRAM)\n  - `cuda:X`: Offload to another GPU (good balance if available)\n\n- **cache_model**: Keep DiT model loaded on offload_device between workflow runs\n  - Useful for batch processing to avoid repeated loading\n  - Requires offload_device to be set\n\n- **blocks_to_swap**: BlockSwap memory optimization\n  - `0`: Disabled (default)\n  - `1-32`: Number of transformer blocks to swap for 3B model\n  - `1-36`: Number of transformer blocks to swap for 7B model\n  - Higher values = more VRAM savings but slower processing\n  - Requires offload_device to be set and different from device\n\n- **swap_io_components**: Offload input\u002Foutput embeddings and normalization layers\n  - Additional VRAM savings when combined with blocks_to_swap\n  - Requires offload_device to be set and different from device\n\n- **attention_mode**: Attention computation backend\n  - `sdpa`: PyTorch scaled_dot_product_attention (default, always available)\n  - `flash_attn_2`: Flash Attention 2 (Ampere+, requires flash-attn package)\n  - `flash_attn_3`: Flash Attention 3 (Hopper+, requires flash-attn with FA3 support)\n  - `sageattn_2`: SageAttention 2 (requires sageattention package)\n  - `sageattn_3`: SageAttention 3 (Blackwell\u002FRTX 50xx, requires sageattn3 package)\n\n- **torch_compile_args**: Connect to SeedVR2 Torch Compile Settings node for 20-40% speedup\n\n**BlockSwap Explained:**\n\nBlockSwap enables running large models on GPUs with limited VRAM by dynamically swapping transformer blocks between GPU and CPU memory during inference.\n\n> **Note:** BlockSwap is not available on macOS. Apple Silicon Macs use unified memory architecture where GPU and CPU share the same memory pool, making BlockSwap meaningless. The option will be automatically disabled with a warning if requested on macOS.\n\nHere's how it works:\n\n- **What it does**: Keeps only the currently-needed transformer blocks on the GPU, while storing the rest on CPU or another device\n- **When to use it**: When you get OOM (Out of Memory) errors during the upscaling phase\n- **How to configure**:\n  1. Set `offload_device` to `cpu` or another GPU\n  2. Start with `blocks_to_swap=16` (half the blocks)\n  3. If still getting OOM, increase to 24 or 32 (3B) \u002F 36 (7B)\n  4. Enable `swap_io_components` for maximum VRAM savings\n  5. If you have plenty of VRAM, decrease or set to 0 for faster processing\n\n**Example Configuration for Low VRAM (8GB)**:\n- model: `seedvr2_ema_3b-Q8_0.gguf`\n- device: `cuda:0`\n- offload_device: `cpu`\n- blocks_to_swap: `32`\n- swap_io_components: `True`\n\n#### 2. SeedVR2 (Down)Load VAE Model\n\n![SeedVR2 (Down)Load VAE Model](docs\u002Fvae_model_loader.png)\n\nConfigure the VAE (Variational Autoencoder) model for encoding\u002Fdecoding video frames.\n\n**Parameters:**\n\n- **model**: VAE model selection\n  - `ema_vae_fp16.safetensors`: Default and recommended\n\n- **device**: GPU device for VAE inference (e.g., `cuda:0`)\n\n- **offload_device**: Device to offload VAE model when not actively processing\n  - `none`: Keep model on inference device (default, fastest)\n  - `cpu`: Offload to system RAM (reduces VRAM)\n  - `cuda:X`: Offload to another GPU (good balance if available)\n\n- **cache_model**: Keep VAE model loaded on offload_device between workflow runs\n  - Requires offload_device to be set\n\n- **encode_tiled**: Enable tiled encoding to reduce VRAM usage during encoding phase\n  - Enable if you see OOM errors during the \"Encoding\" phase in debug logs\n\n- **encode_tile_size**: Encoding tile size in pixels (default: 1024)\n  - Applied to both height and width\n  - Lower values reduce VRAM but may increase processing time\n\n- **encode_tile_overlap**: Encoding tile overlap in pixels (default: 128)\n  - Reduces visible seams between tiles\n\n- **decode_tiled**: Enable tiled decoding to reduce VRAM usage during decoding phase\n  - Enable if you see OOM errors during the \"Decoding\" phase in debug logs\n\n- **decode_tile_size**: Decoding tile size in pixels (default: 1024)\n\n- **decode_tile_overlap**: Decoding tile overlap in pixels (default: 128)\n\n- **torch_compile_args**: Connect to SeedVR2 Torch Compile Settings node for 15-25% speedup\n\n**VAE Tiling Explained:**\n\nVAE tiling processes large resolutions in smaller tiles to reduce VRAM requirements. Here's how to use it:\n\n1. **Run without tiling first** and monitor the debug logs (enable `enable_debug` on main node)\n2. **If OOM during \"Encoding\" phase**:\n   - Enable `encode_tiled`\n   - If still OOM, reduce `encode_tile_size` (try 768, 512, etc.)\n3. **If OOM during \"Decoding\" phase**:\n   - Enable `decode_tiled`\n   - If still OOM, reduce `decode_tile_size`\n4. **Adjust overlap** (default 128) if you see visible seams in output (increase it) or processing times are too slow (decrease it).\n\n**Example Configuration for High Resolution (4K)**:\n- encode_tiled: `True`\n- encode_tile_size: `1024`\n- encode_tile_overlap: `128`\n- decode_tiled: `True`\n- decode_tile_size: `1024`\n- decode_tile_overlap: `128`\n\n#### 3. SeedVR2 Torch Compile Settings (Optional)\n\n![SeedVR2 Torch Compile Settings](docs\u002Ftorch_compile_settings.png)\n\nConfigure torch.compile optimization for 20-40% DiT speedup and 15-25% VAE speedup.\n\n**Requirements:**\n- PyTorch 2.0+\n- Triton (for inductor backend)\n\n**Parameters:**\n\n- **backend**: Compilation backend\n  - `inductor`: Full optimization with Triton kernel generation and fusion (recommended)\n  - `cudagraphs`: Lightweight wrapper using CUDA graphs, no kernel optimization\n\n- **mode**: Optimization level (compilation time vs runtime performance)\n  - `default`: Fast compilation with good speedup (recommended for development)\n  - `reduce-overhead`: Lower overhead, optimized for smaller models\n  - `max-autotune`: Slowest compilation, best runtime performance (recommended for production)\n  - `max-autotune-no-cudagraphs`: Like max-autotune but without CUDA graphs\n\n- **fullgraph**: Compile entire model as single graph without breaks\n  - `False`: Allow graph breaks for better compatibility (default, recommended)\n  - `True`: Enforce no breaks for maximum optimization (may fail with dynamic shapes)\n\n- **dynamic**: Handle varying input shapes without recompilation\n  - `False`: Specialize for exact input shapes (default)\n  - `True`: Create dynamic kernels that adapt to shape variations (enable when processing different resolutions or batch sizes)\n\n- **dynamo_cache_size_limit**: Max cached compiled versions per function (default: 64)\n  - Higher = more memory, lower = more recompilation\n\n- **dynamo_recompile_limit**: Max recompilation attempts before falling back to eager mode (default: 128)\n  - Safety limit to prevent compilation loops\n\n**Usage:**\n1. Add this node to your workflow\n2. Connect its output to the `torch_compile_args` input of DiT and\u002For VAE loader nodes\n3. First run will be slow (compilation), subsequent runs will be much faster\n\n**When to use:**\n- torch.compile only makes sense when processing **multiple batches, long videos, or many tiles**\n- For single images or short clips, the compilation time outweighs the speed improvement\n- Best suited for batch processing workflows or long videos\n\n**Recommended Settings:**\n- For development\u002Ftesting: `mode=default`, `backend=inductor`, `fullgraph=False`\n- For production: `mode=max-autotune`, `backend=inductor`, `fullgraph=False`\n\n#### 4. SeedVR2 Video Upscaler (Main Node)\n\n![SeedVR2 Video Upscaler](docs\u002Fvideo_upscaler.png)\n\nMain upscaling node that processes video frames using DiT and VAE models.\n\n**Required Inputs:**\n\n- **image**: Input video frames as image batch (RGB or RGBA format)\n- **dit**: DiT model configuration from SeedVR2 (Down)Load DiT Model node\n- **vae**: VAE model configuration from SeedVR2 (Down)Load VAE Model node\n\n**Parameters:**\n\n- **seed**: Random seed for reproducible generation (default: 42)\n  - Same seed with same inputs produces identical output\n\n- **resolution**: Target resolution for shortest edge in pixels (default: 1080)\n  - Maintains aspect ratio automatically\n\n- **max_resolution**: Maximum resolution for any edge (default: 0 = no limit)\n  - Automatically scales down if exceeded to prevent OOM\n\n- **batch_size**: Frames per batch (default: 5)\n  - **CRITICAL REQUIREMENT**: Must follow the **4n+1 formula** (1, 5, 9, 13, 17, 21, 25, ...)\n  - **Why this matters**: The model uses these frames for temporal consistency calculations\n  - **Minimum 5 for temporal consistency**: Use 1 only for single images or when temporal consistency isn't needed\n  - **Match shot length ideally**: For best results, set batch_size to match your shot length (e.g., batch_size=21 for a 20-frame shot)\n  - **VRAM impact**: Higher batch_size = better quality and speed but requires more VRAM\n  - **If you get OOM with batch_size=5**: Try optimization techniques first (model offloading, BlockSwap, GGUF models...) before reducing batch_size or input resolution, as these directly impact quality\n\n**uniform_batch_size** (default: False)\n  - Pads the final batch to match `batch_size` for uniform processing\n  - Prevents temporal artifacts when the last batch is significantly smaller than others\n  - Example: 45 frames with `batch_size=33` creates [33, 33] instead of [33, 12]\n  - Recommended when using large batch sizes and video length is not a multiple of `batch_size`\n  - Increases VRAM usage slightly but ensures consistent temporal coherence across all batches\n\n- **temporal_overlap**: Overlapping frames between batches (default: 0)\n  - Used for blending between batches to reduce temporal artifacts\n  - Range: 0-16 frames\n\n- **prepend_frames**: Frames to prepend (default: 0)\n  - Prepends reversed frames to reduce artifacts at video start\n  - Automatically removed after processing\n  - Range: 0-32 frames\n\n- **color_correction**: Color correction method (default: \"wavelet\")\n  - **`lab`**: Full perceptual color matching with detail preservation (recommended for highest fidelity to original)\n  - **`wavelet`**: Frequency-based natural colors, preserves details well\n  - **`wavelet_adaptive`**: Wavelet base + targeted saturation correction\n  - **`hsv`**: Hue-conditional saturation matching\n  - **`adain`**: Statistical style transfer\n  - **`none`**: No color correction\n\n- **input_noise_scale**: Input noise injection scale 0.0-1.0 (default: 0.0)\n  - Adds noise to input frames to reduce artifacts at very high resolutions\n  - Try 0.1-0.3 if you see artifacts with high output resolutions\n\n- **latent_noise_scale**: Latent space noise scale 0.0-1.0 (default: 0.0)\n  - Adds noise during diffusion process, can soften excessive detail\n  - Use if input_noise doesn't help, try 0.05-0.15\n\n- **offload_device**: Device for storing intermediate tensors between processing phases (default: \"cpu\")\n  - `none`: Keep all tensors on inference device (fastest but highest VRAM)\n  - `cpu`: Offload to system RAM (recommended for long videos, slower transfers)\n  - `cuda:X`: Offload to another GPU (good balance if available, faster than CPU)\n\n- **enable_debug**: Enable detailed debug logging (default: False)\n  - Shows memory usage, timing information, and processing details\n  - **Highly recommended** for troubleshooting OOM issues\n\n**Output:**\n- Upscaled video frames with color correction applied\n- Format (RGB\u002FRGBA) matches input\n- Range [0, 1] normalized for ComfyUI compatibility\n\n### Typical Workflow Setup\n\n**Basic Workflow (High VRAM - 24GB+)**:\n```\nLoad Video Frames\n    ↓\nSeedVR2 Load DiT Model\n  ├─ model: seedvr2_ema_3b_fp16.safetensors\n  └─ device: cuda:0\n    ↓\nSeedVR2 Load VAE Model\n  ├─ model: ema_vae_fp16.safetensors\n  └─ device: cuda:0\n    ↓\nSeedVR2 Video Upscaler\n  ├─ batch_size: 21\n  └─ resolution: 1080\n    ↓\nSave Video\u002FFrames\n```\n\n**Low VRAM Workflow (8-12GB)**:\n```\nLoad Video Frames\n    ↓\nSeedVR2 Load DiT Model\n  ├─ model: seedvr2_ema_3b-Q8_0.gguf\n  ├─ device: cuda:0\n  ├─ offload_device: cpu\n  ├─ blocks_to_swap: 32\n  └─ swap_io_components: True\n    ↓\nSeedVR2 Load VAE Model\n  ├─ model: ema_vae_fp16.safetensors\n  ├─ device: cuda:0\n  ├─ encode_tiled: True\n  └─ decode_tiled: True\n    ↓\nSeedVR2 Video Upscaler\n  ├─ batch_size: 5\n  └─ resolution: 720\n    ↓\nSave Video\u002FFrames\n```\n\n**High Performance Workflow (24GB+ with torch.compile)**:\n```\nLoad Video Frames\n    ↓\nSeedVR2 Torch Compile Settings\n  ├─ mode: max-autotune\n  └─ backend: inductor\n    ↓\nSeedVR2 Load DiT Model\n  ├─ model: seedvr2_ema_7b_sharp_fp16.safetensors\n  ├─ device: cuda:0\n  └─ torch_compile_args: connected\n    ↓\nSeedVR2 Load VAE Model\n  ├─ model: ema_vae_fp16.safetensors\n  ├─ device: cuda:0\n  └─ torch_compile_args: connected\n    ↓\nSeedVR2 Video Upscaler\n  ├─ batch_size: 81\n  └─ resolution: 1080\n    ↓\nSave Video\u002FFrames\n```\n\n## 🖥️ Run as Standalone (CLI)\n\nThe standalone CLI provides powerful batch processing capabilities with multi-GPU support and sophisticated optimization options.\n\n### Prerequisites\n\nChoose the appropriate setup based on your installation:\n\n#### Option 1: Already Have ComfyUI with SeedVR2 Installed\n\nIf you've already installed SeedVR2 as part of ComfyUI (via [ComfyUI installation](#-installation)), you can use the CLI directly:\n\n```bash\n# Navigate to your ComfyUI directory\ncd ComfyUI\n\n# Run the CLI using standalone Python (display help message)\n# Windows:\n.venv\\Scripts\\python.exe custom_nodes\\seedvr2_videoupscaler\\inference_cli.py --help\n# Linux\u002FmacOS:\n.venv\u002Fbin\u002Fpython custom_nodes\u002Fseedvr2_videoupscaler\u002Finference_cli.py --help\n```\n\n**Skip to [Command Line Usage](#command-line-usage) below.**\n\n#### Option 2: Standalone Installation (Without ComfyUI)\n\nIf you want to use the CLI without ComfyUI installation, follow these steps:\n\n1. **Install [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002Fgetting-started\u002Finstallation\u002F)** (modern Python package manager):\n```bash\n# Windows\npowershell -ExecutionPolicy ByPass -c \"irm https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.ps1 | iex\"\n\n# macOS and Linux\ncurl -LsSf https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.sh | sh\n```\n\n2. **Clone the repository**:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler.git seedvr2_videoupscaler\ncd seedvr2_videoupscaler\n```\n\n3. **Create virtual environment and install dependencies**:\n```bash\n# Create virtual environment with Python 3.13\nuv venv --python 3.13\n\n# Activate virtual environment\n# Windows:\n.venv\\Scripts\\activate\n# Linux\u002FmacOS:\nsource .venv\u002Fbin\u002Factivate\n\n# Install PyTorch with CUDA support\n# Check command line based on your environment: https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F\nuv pip install --pre torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fnightly\u002Fcu130\n\n# Install SeedVR2 requirements\nuv pip install -r requirements.txt\n\n# Run the CLI (display help message)\n# Windows:\n.venv\\Scripts\\python.exe inference_cli.py --help\n# Linux\u002FmacOS:\n.venv\u002Fbin\u002Fpython inference_cli.py --help\n```\n\n### Command Line Usage\n\nThe CLI provides comprehensive options for single-GPU, multi-GPU, and batch processing workflows.\n\n**Basic Usage Examples:**\n\n```bash\n# Basic image upscaling\npython inference_cli.py image.jpg\n\n# Basic video upscaling with temporal consistency\npython inference_cli.py video.mp4 --resolution 720 --batch_size 33\n\n# Streaming mode for long videos (memory-efficient) with 10-bit video output (requires FFMPEG)\n# Processes video in chunks of 330 frames to avoid loading entire video into RAM\n# Use --temporal_overlap to ensure smooth transitions between chunks\npython inference_cli.py long_video.mp4 \\\n    --resolution 1080 \\\n    --batch_size 33 \\\n    --chunk_size 330 \\\n    --temporal_overlap 3 \\\n    --video_backend ffmpeg \\\n    --10bit\n\n# Multi-GPU processing with temporal overlap\npython inference_cli.py video.mp4 \\\n    --cuda_device 0,1 \\\n    --resolution 1080 \\\n    --batch_size 81 \\\n    --uniform_batch_size \\\n    --temporal_overlap 3 \\\n    --prepend_frames 4\n\n# Memory-optimized for low VRAM (8GB)\npython inference_cli.py image.png \\\n    --dit_model seedvr2_ema_3b-Q8_0.gguf \\\n    --resolution 1080 \\\n    --blocks_to_swap 32 \\\n    --swap_io_components \\\n    --dit_offload_device cpu \\\n    --vae_offload_device cpu\n\n# High resolution with VAE tiling\npython inference_cli.py video.mp4 \\\n    --resolution 1440 \\\n    --batch_size 31 \\\n    --uniform_batch_size \\\n    --temporal_overlap 3 \\\n    --vae_encode_tiled \\\n    --vae_decode_tiled\n\n# Batch directory processing with model caching\npython inference_cli.py media_folder\u002F \\\n    --output processed\u002F \\\n    --cuda_device 0 \\\n    --cache_dit \\\n    --cache_vae \\\n    --dit_offload_device cpu \\\n    --vae_offload_device cpu \\\n    --resolution 1080 \\\n    --max_resolution 1920\n```\n\n### Command Line Arguments\n\n**Input\u002FOutput:**\n- `\u003Cinput>`: Input file (.mp4, .avi, .png, .jpg, etc.) or directory\n- `--output`: Output path (default: auto-generated in 'output\u002F' directory)\n- `--output_format`: Output format: 'mp4' (video) or 'png' (image sequence). Default: auto-detect from input type\n- `--video_backend`: Video encoder backend: 'opencv' (default) or 'ffmpeg' (requires ffmpeg in PATH)\n- `--10bit`: Save 10-bit video with x265 codec and yuv420p10le pixel format (reduces banding in gradients). Without this flag, ffmpeg uses x264 (yuv420p) for maximum compatibility. Requires --video_backend ffmpeg\n- `--model_dir`: Model directory (default: .\u002Fmodels\u002FSEEDVR2)\n\n**Model Selection:**\n- `--dit_model`: DiT model to use. Options: 3B\u002F7B with fp16\u002Ffp8\u002FGGUF variants (default: 3B FP8)\n\n**Processing Parameters:**\n- `--resolution`: Target short-side resolution in pixels (default: 1080)\n- `--max_resolution`: Maximum resolution for any edge. Scales down if exceeded. 0 = no limit (default: 0)\n- `--batch_size`: Frames per batch (must follow 4n+1: 1, 5, 9, 13, 17, 21...). Ideally matches shot length for best temporal consistency (default: 5)\n- `--seed`: Random seed for reproducibility (default: 42)\n- `--skip_first_frames`: Skip N initial frames (default: 0)\n- `--load_cap`: Maximum total frames to load from video. 0 = load all (default: 0)\n- `--chunk_size`: Frames per chunk for streaming mode. When > 0, processes video in memory-bounded chunks of N frames, writing each chunk before loading the next. Essential for long videos that would otherwise exceed RAM. Use with `--temporal_overlap` for seamless chunk transitions. 0 = load all frames at once (default: 0)\n- `--prepend_frames`: Prepend N reversed frames to reduce start artifacts (auto-removed) (default: 0)\n- `--temporal_overlap`: Frames to overlap between batches\u002FGPUs for smooth blending (default: 0)\n\n**Quality Control:**\n- `--color_correction`: Color correction method: 'lab' (perceptual, recommended), 'wavelet', 'wavelet_adaptive', 'hsv', 'adain', or 'none' (default: lab)\n- `--input_noise_scale`: Input noise injection scale (0.0-1.0). Reduces artifacts at high resolutions (default: 0.0)\n- `--latent_noise_scale`: Latent space noise scale (0.0-1.0). Softens details if needed (default: 0.0)\n\n**Memory Management:**\n- `--dit_offload_device`: Device to offload DiT model: 'none' (keep on GPU), 'cpu', or 'cuda:X' (default: none)\n- `--vae_offload_device`: Device to offload VAE model: 'none', 'cpu', or 'cuda:X' (default: none)\n- `--blocks_to_swap`: Number of transformer blocks to swap (0=disabled, 3B: 0-32, 7B: 0-36). Requires dit_offload_device (default: 0). Not available on macOS.\n- `--swap_io_components`: Offload I\u002FO components for additional VRAM savings. Requires dit_offload_device. Not available on macOS.\n\n**VAE Tiling:**\n- `--vae_encode_tiled`: Enable VAE encode tiling to reduce VRAM during encoding\n- `--vae_encode_tile_size`: VAE encode tile size in pixels (default: 1024)\n- `--vae_encode_tile_overlap`: VAE encode tile overlap in pixels (default: 128)\n- `--vae_decode_tiled`: Enable VAE decode tiling to reduce VRAM during decoding\n- `--vae_decode_tile_size`: VAE decode tile size in pixels (default: 1024)\n- `--vae_decode_tile_overlap`: VAE decode tile overlap in pixels (default: 128)\n- `--tile_debug`: Visualize tiles: 'false' (default), 'encode', or 'decode'\n\n**Performance Optimization:**\n- `--allow_vram_overflow`: Allow VRAM overflow to system RAM. Prevents OOM but may cause severe slowdown\n- `--attention_mode`: Attention backend: 'sdpa' (default), 'flash_attn_2' (Ampere+), 'flash_attn_3' (Hopper+), 'sageattn_2', or 'sageattn_3' (Blackwell)\n- `--compile_dit`: Enable torch.compile for DiT model (20-40% speedup, requires PyTorch 2.0+ and Triton)\n- `--compile_vae`: Enable torch.compile for VAE model (15-25% speedup, requires PyTorch 2.0+ and Triton)\n- `--compile_backend`: Compilation backend: 'inductor' (full optimization) or 'cudagraphs' (lightweight) (default: inductor)\n- `--compile_mode`: Optimization level: 'default', 'reduce-overhead', 'max-autotune', 'max-autotune-no-cudagraphs' (default: default)\n- `--compile_fullgraph`: Compile entire model as single graph (faster but less flexible) (default: False)\n- `--compile_dynamic`: Handle varying input shapes without recompilation (default: False)\n- `--compile_dynamo_cache_size_limit`: Max cached compiled versions per function (default: 64)\n- `--compile_dynamo_recompile_limit`: Max recompilation attempts before fallback (default: 128)\n\n**Model Caching (batch processing):**\n- `--cache_dit`: Keep DiT model in memory between generations. Works with single-GPU directory processing or multi-GPU streaming (`--chunk_size`). Requires `--dit_offload_device`\n- `--cache_vae`: Keep VAE model in memory between generations. Works with single-GPU directory processing or multi-GPU streaming (`--chunk_size`). Requires `--vae_offload_device`\n\n**Multi-GPU:**\n- `--cuda_device`: CUDA device id(s). Single id (e.g., '0') or comma-separated list '0,1' for multi-GPU\n\n**Debugging:**\n- `--debug`: Enable verbose debug logging\n\n### Multi-GPU Processing Explained\n\nThe CLI's multi-GPU mode uses **frame-level parallelism**: the video is split into chunks and each GPU processes its chunk independently through all 4 phases (encode → upscale → decode → postprocess). This is ideal for long videos where you want to reduce total processing time by dividing the workload.\n\n**How it works:**\n1. Video frames are split evenly across GPUs (e.g., 100 frames on 2 GPUs → 50 frames each)\n2. Each GPU loads its own copy of the models and processes its chunk independently\n3. When `--temporal_overlap` is set, chunks include overlapping frames for seamless blending\n4. Results are concatenated (and blended at overlap regions) into the final video\n\n**Example for 100 frames on 2 GPUs with temporal_overlap=4:**\n```\nGPU 0: Frames 0-53 (50 base + 4 overlap at end, processed as independent video)\nGPU 1: Frames 50-99 (50 frames, 4 overlap at start, processed as independent video)\nResult: Frames 0-99 with smooth blending at the transition point\n```\n\n**Important considerations:**\n- Each GPU processes its chunk as a separate video with its own batch splitting\n- `batch_size` controls batching *within* each GPU's chunk, not across GPUs\n- For short videos (\u003C 100 frames), single GPU is often more efficient due to model loading overhead\n- Multi-GPU doubles VRAM usage (each GPU loads full models) but roughly halves processing time\n\n**When to use multi-GPU:**\n- Long videos (100+ frames) where splitting provides significant time savings\n- When you have multiple GPUs with sufficient VRAM each\n\n**When to use single GPU:**\n- Short videos where model loading overhead outweighs parallel gains\n- When you want all frames processed together for maximum temporal coherence\n\n**Best practices:**\n- Set `--temporal_overlap` to 2-4 frames for smooth blending between GPU chunks\n- Higher overlap = smoother transitions but more redundant processing\n- Use `--prepend_frames` to reduce artifacts at video start\n- For optimal quality on short videos, use single GPU with `batch_size` matching your shot length\n\n## ⚠️ Limitations\n\n### Model Limitations\n\n**Batch Size Constraint**: The model requires batch_size to follow the **4n+1 formula** (1, 5, 9, 13, 17, 21, 25, ...) due to temporal consistency architecture. All frames in a batch are processed together for temporal coherence, then batches can be blended using temporal_overlap. Ideally, set batch_size to match your shot length for optimal quality.\n\n### Performance Considerations\n\n**VAE Bottleneck**: Even with optimized DiT upscaling (BlockSwap, GGUF, torch.compile), the VAE encoding\u002Fdecoding stages can be the bottleneck, especially for high resolutions. The VAE is slow. Use large batch_size to mitigate this.\n\n**VRAM Usage**: While the integration now supports low VRAM systems (8GB or less with proper optimization), VRAM usage varies based on:\n- Input\u002Foutput resolution (larger = more VRAM)\n- Batch size (higher = more VRAM but better temporal consistency and speed)\n- Model choice (FP16 > FP8 > GGUF in VRAM usage)\n- Optimization settings (BlockSwap, VAE tiling significantly reduce VRAM)\n\n**Speed**: Processing speed depends on:\n- GPU capabilities (compute performance, VRAM bandwidth, and architecture generation)\n- Model size (3B faster than 7B)\n- Batch size (larger batch sizes are faster per frame due to better GPU utilization)\n- Optimization settings (torch.compile provides significant speedup)\n- Resolution (higher resolutions are slower)\n\n### Best Practices\n\n1. **Start with debug enabled** to understand where VRAM is being used\n2. **For OOM errors during encoding**: Enable VAE encode tiling and reduce tile size\n3. **For OOM errors during upscaling**: Enable BlockSwap and increase blocks_to_swap\n4. **For OOM errors during decoding**: Enable VAE decode tiling and reduce tile size\n   - **If still getting OOM after trying all above**: Reduce batch_size or resolution\n5. **For best quality**: Use higher batch_size matching your shot length, FP16 models, and LAB color correction\n6. **For speed**: Use FP8\u002FGGUF models, enable torch.compile, and use Flash Attention if available\n7. **Test settings with a short clip first** before processing long videos\n\n## 🤝 Contributing\n\nContributions are welcome! We value community input and improvements.\n\nFor detailed contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n**Quick Start:**\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature\u002FAmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature\u002FAmazingFeature`)\n5. Open a Pull Request to the **main** branch\n\n**Get Help:**\n- YouTube: [AInVFX Channel](https:\u002F\u002Fwww.youtube.com\u002F@AInVFX)\n- GitHub [Issues](https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler\u002Fissues): For bug reports and feature requests\n- GitHub [Discussions](https:\u002F\u002Fgithub.com\u002Fnumz\u002FComfyUI-SeedVR2_VideoUpscaler\u002Fdiscussions): For questions and community support\n- Discord: adrientoupet & NumZ#7184\n\n## 🙏 Credits\n\nThis ComfyUI implementation is a collaborative project by **[NumZ](https:\u002F\u002Fgithub.com\u002Fnumz)** and **[AInVFX](https:\u002F\u002Fwww.youtube.com\u002F@AInVFX)** (Adrien Toupet), based on the original [SeedVR2](https:\u002F\u002Fgithub.com\u002FByteDance-Seed\u002FSeedVR) by ByteDance Seed Team.\n\nSpecial thanks to our community contributors including [naxci1](https:\u002F\u002Fgithub.com\u002Fnaxci1), [thehhmdb](https:\u002F\u002Fgithub.com\u002Fthehhmdb), [s-cerevisiae](https:\u002F\u002Fgithub.com\u002Fs-cerevisiae), [benjaminherb](https:\u002F\u002Fgithub.com\u002Fbenjaminherb), [cmeka](https:\u002F\u002Fgithub.com\u002Fcmeka), [FurkanGozukara](https:\u002F\u002Fgithub.com\u002FFurkanGozukara), [JohnAlcatraz](https:\u002F\u002Fgithub.com\u002FJohnAlcatraz), [lihaoyun6](https:\u002F\u002Fgithub.com\u002Flihaoyun6), [Luchuanzhao](https:\u002F\u002Fgithub.com\u002FLuchuanzhao), [Luke2642](https:\u002F\u002Fgithub.com\u002FLuke2642), [proxyid](https:\u002F\u002Fgithub.com\u002Fproxyid), [q5sys](https:\u002F\u002Fgithub.com\u002Fq5sys), and many others for their improvements, bug fixes, and testing.\n\n## 📜 License\n\nThe code in this repository is released under the Apache 2.0 license as found in the [LICENSE](LICENSE) file.","ComfyUI-SeedVR2_VideoUpscaler 是一个专为 ComfyUI 设计的视频和图像超分辨率处理工具。该项目基于 SeedVR2 技术，能够显著提升视频和图像的质量。其核心功能包括支持多GPU独立命令行运行、提供高质量的视频和图像放大处理能力，并且具备良好的兼容性和安全性。该工具特别适用于需要对低分辨率视频或图像进行增强处理的场景，例如老旧影片修复、监控视频清晰度提升等。通过使用 Python 语言开发，项目遵循 Apache License 2.0 开源协议，确保了广泛的可用性和社区参与度。",2,"2026-06-11 03:42:11","high_star"]