diff --git a/README.md b/README.md index 310acd3..8d0a841 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,25 @@ # ♾️ ComfyUI Sequential Batcher -**v1.5.4** | **VRAM-Optimized Generation** | **Recursive Self-Queuing** +**v1.6.0** | **VRAM-Optimized Generation** | **Recursive Self-Queuing** | **Perfect Audio Sync** -Una suite de grado profesional de nodos personalizados para ComfyUI. Diseñada para sortear los límites de VRAM en la generación de vídeo pesado (WanVideo, Hunyuan, etc.) mediante **Auto-Encolado Recursivo** y procesamiento autónomo lote por lote. +Una suite de grado profesional de nodos personalizados para ComfyUI. Diseñada para sortear los límites extremos de VRAM en la generación de vídeo pesado (WanVideo, Hunyuan, LTX) mediante **Auto-Encolado Recursivo**, procesamiento autónomo lote por lote y gestión de memoria forense. > 🌍 **Read in English:** [README_EN.md](README_EN.md) --- +## 🌟 Lo Nuevo en v1.6.0 (Perfect Sync Update) +* **🛡️ VAE Safe Frame Padder (Hold Last Frame):** El motor ahora expande dinámicamente los tensores incompletos al final del vídeo. Si faltan frames para cumplir los estrictos requisitos de WanVideo (múltiplos de 4) o LTX (8n+1), clona el último fotograma de forma imperceptible. **Resultado: Cero cuelgues del VAE y 100% de sincronización de audio sin micro-cortes.** +* **📈 Inversión Matemática a "Expansión":** Los calculadores `AutoLoopCalculatorWan` y `AutoLoopCalculatorLTX` ahora redondean el timeline de forma segura hacia arriba, garantizando fluidez total en ciclos intermedios. + +--- + ## ✨ Características Clave -* **Orquestación Autónoma:** Convierte tu ComfyUI en un motor de renderizado continuo. Pulsa "Queue" una sola vez y el flujo se retroalimentará hasta terminar todo el vídeo. -* **Cortes Inteligentes (Smart Chunking):** Analiza el vídeo base y realiza cortes matemáticos evitando separar frames donde los rostros son más nítidos, manteniendo la coherencia de identidad. -* **Extracción de Audio Nativa:** Extrae la pista de audio original directamente desde el nodo inicial y la inyecta de vuelta en el ensamblaje final. -* **Dual Input Engine:** El nodo explorador acepta tanto vídeos subidos manualmente como rutas inyectadas por cable desde descargadores (ej. YTDLP) comportándose exactamente como VideoHelperSuite. -* **Soporte Nativo LTX 2.3:** Se han añadido calculadores matemáticos específicos (`AutoLoopCalculatorLTX` y `ResTool64xLTX`) para garantizar que los lotes de vídeo cumplan con las estrictas reglas de descompresión de arquitectura DiT y el factor de escala latente (resoluciones divisibles por 64 y particiones de fotogramas de `8n + 1`). +* **Orquestación Autónoma:** Convierte tu ComfyUI en un motor de renderizado continuo. Pulsa "Queue Prompt" una sola vez y el flujo se retroalimentará modificando semillas e índices hasta terminar todo el vídeo. +* **Cortes Inteligentes (Smart Chunking):** Analiza el vídeo base y realiza cortes matemáticos protegiendo los frames donde los rostros son más nítidos, manteniendo la coherencia de identidad (Face Cuts). +* **Extracción de Audio Nativa:** Extrae la pista original directamente desde el nodo inicial y la inyecta de vuelta en el ensamblaje final. +* **Soporte Arquitecturas DiT (WanVideo & LTX 2.3):** Calculadores matemáticos específicos aseguran que los lotes de vídeo cumplan con las estrictas reglas de descompresión (múltiplos de 4 para WanVideo, o regla `8n + 1` para LTX). +* **Resoluciones Protegidas (Megapixel Shield):** Herramientas matemáticas (`ResTool`) que escalan las dimensiones automáticamente protegiendo el *training floor* de cada modelo base. --- @@ -22,58 +28,51 @@ Una suite de grado profesional de nodos personalizados para ComfyUI. Diseñada p Para que el nodo `VideoAnalyzerWithAudio` pueda desempaquetar contenedores `.mp4` y extraer el audio con `torchaudio`, **FFmpeg es absolutamente obligatorio**. * **🐧 Ubuntu / Linux / WSL2:** - El script de ComfyUI Manager intentará instalarlo por ti. Si falla, ejecuta: + El script intentará instalarlo por ti. Si falla, ejecuta manualmente: ```bash sudo apt update && sudo apt install ffmpeg -y ``` * **🪟 Windows:** - Descarga los binarios precompilados de FFmpeg y añade la carpeta bin a tus variables de entorno (PATH). + Descarga los binarios precompilados de FFmpeg y añade la carpeta `bin` a tus variables de entorno (PATH). -## 🧠 La Arquitectura Híbrida (Cómo funciona) -El procesamiento de vídeo se divide en roles altamente especializados: +--- -* **🕵️ Video Analyzer Face detector + Audio (El Explorador):** Escanea el vídeo vía OpenCV o mediante un modelo YOLO/ONNX acelerado por GPU (opcional) para detección precisa de rostros, extrae el audio y escupe un Frame de Referencia visual. Actúa como la puerta de entrada principal. -* **📊 Auto Loop Calculator (El Cerebro):** Recibe la biometría del Explorador y calcula las coordenadas de corte asimétricas (chunk_frames, skip_frames) con un margen dinámico del ±10% para evitar minilotes residuales. -* **📊 Auto Loop Calculator (WanVideo 3dVAE):** Alternativa para WanVideo que asegura que los chunks de frames sean estrictamente múltiplos de 4, protegiendo al VAE 3D de colapsar. -* **🛠️ El Obrero (VHS_LoadVideo):** Liberado de tareas de análisis, este nodo estándar de ComfyUI se limita a extraer los tensores exactos que el Cerebro le ordena. -* **🎞️ Incremental Auto-Stitcher (El Ensamblador):** Recoge los lotes renderizados y la pista de audio original, cosiendo el vídeo final de forma progresiva. -* **📥 Session Image Receiver** y **📤 Session Image Sender:** Retienen y transfieren el último keyframe válido (frame de referencia) a través de los ciclos para mantener la coherencia temporal de la identidad. -* **⏱️ Auto FPS Limiter (El Sincronizador):** Previene errores de VRAM en vídeos de alta tasa de fotogramas (ej. 60 FPS) calculando automáticamente el salto de frames necesario (`select_every_nth`) y ajustando los FPS finales para garantizar que el audio y el movimiento mantengan una sincronización perfecta. -* **🔀 Master Switch (Evaluación Perezosa y Cirugía de Grafo):** Nodo lógico avanzado que utiliza *Evaluación Perezosa Nativa* en el Ciclo 0 y *Cirugía de Grafo en Caliente* en ciclos posteriores. Amputa físicamente los cables de rutas inactivas en el JSON enviado a ComfyUI, asegurando que los nodos pesados (como Lip Syncs o Upscalers) ni siquiera se carguen en memoria cuando no se necesitan, lo que representa un ahorro masivo de VRAM. -* **Resoluciones Protegidas (Megapixel Shield):** Herramientas de resolución matemáticas que escalan las dimensiones para evitar artefactos protegiendo el "training floor" de cada modelo: - * **📐 ResTool 8x (SD1.5)** - * **📏 ResTool 16x (SDXL)** - * **🎞️ ResTool 32x (WanVideo)** - * **🎬 ResTool 64x (Hunyuan)** +## 🧠 La Arquitectura Híbrida (Desglose de Nodos) +El procesamiento se divide en roles altamente especializados: -## 🔌 Guía de Cableado (Workflow Setup) -Para montar el flujo secuencial perfecto, sigue estos pasos: +* **🕵️ Video Analyzer Face detector + Audio:** Escanea el vídeo vía OpenCV o mediante un modelo YOLO acelerado por GPU. Extrae rostros, el audio y el Frame de Referencia. +* **📊 Auto Loop Calculator (Base / WanVideo / LTX):** Recibe la biometría y calcula las coordenadas de corte (chunk_frames, skip_frames). +* **🛡️ VAE Safe Frame Padder:** Intercepta el tensor final de VHS y lo rellena ("acolcha") clonando el último frame si falta material, salvando al VAE de un colapso. +* **🎞️ Incremental Auto-Stitcher:** Recoge los lotes renderizados y la pista de audio, cosiendo el vídeo final de forma progresiva en la carpeta temporal. +* **📥 Receiver & 📤 Sender:** Retienen y transfieren el último keyframe válido a través de los ciclos para mantener la coherencia temporal. +* **⏱️ Auto FPS Limiter:** Reduce los FPS inteligentemente garantizando que el audio y el movimiento mantengan una sincronización perfecta sin romper la VRAM. +* **🔀 Master Switch (Evaluación Perezosa):** Amputa físicamente los cables de rutas inactivas en el JSON enviado a ComfyUI. Los nodos pesados que no se necesitan en un ciclo específico ni siquiera se cargan en memoria. +* **🧹 VRAM Defragmenter:** Purga forense de memoria (Secuencia Sagrada) que limpia la caché de CUDA/MPS y fuerza al Garbage Collector entre ciclos pesados. -1. **Setup Inicial:** Coloca el 🕵️ Video Analyzer Face detector + Audio al principio. Sube un vídeo o conéctale un cable STRING desde tu descargador favorito. Opcionalmente, conecta un nodo 'ONNX Detection Model Loader' a su entrada `bbox_detector` para escaneo de rostros por GPU. -2. **Matemáticas:** Conecta total_frames y safe_faces_list del Explorador hacia el 📊 Auto Loop Calculator (o 📊 Auto Loop Calculator (WanVideo 3dVAE) si usas WanVideo). -3. **Extracción:** Añade un nodo VHS_LoadVideo. Haz clic derecho en él -> Convert Widget to Input -> video. Conecta el video_name del Explorador a esta nueva entrada. Alimenta los parámetros de corte desde el Cerebro. -4. **Passthrough de Audio:** Lleva el cable source_audio desde el Explorador hasta el puerto audio de tu 🎞️ Incremental Auto-Stitcher (al final del flujo). -5. **El Gatillo:** Conecta la salida de tu Stitcher a la entrada del 🚀 Loop Trigger (Auto-Queue). -6. **Ejecución:** Conecta el 🏁 Loop Start (Index) al Cerebro y al Stitcher. Dale a "Queue Prompt" UNA SOLA VEZ (sin marcar Auto Queue en la UI). ¡Disfruta de la magia autónoma! +--- -## 🚀 Aceleración por GPU para el Escaneo de Rostros (NUEVO) -El nodo `VideoAnalyzerWithAudio` ahora cuenta con un puerto de entrada opcional llamado `bbox_detector`. Esto permite delegar el escaneo facial a tu tarjeta gráfica, multiplicando la velocidad de análisis masivamente. +## 🔌 Guía de Cableado Rápido (Workflow Setup) -**Cómo usarlo:** -1. Instala el popular **Impact Pack**. -2. Añade el nodo `UltralyticsDetectorProvider` a tu lienzo. -3. Selecciona un modelo de rostros (ej. `bbox/face_yolov8m.pt`). -4. Conecta la salida `BBOX_DETECTOR` a la nueva entrada de nuestro nodo Explorador. -*Nota: Si no conectas nada a este puerto, el nodo usará un escaneo estándar por CPU (OpenCV) como método de respaldo.* +1. **El Explorador:** Coloca el `Video Analyzer` al principio. Sube un vídeo (o usa una ruta de YTDLP). +2. **Matemáticas:** Conecta `total_frames` y `safe_faces_list` hacia tu `Auto Loop Calculator` elegido. +3. **Extracción Segura:** Añade el nodo nativo `VHS_LoadVideo`. Conviértele la entrada a *video_name* y conéctala al Analyzer. Conecta su salida `IMAGE` al nuevo nodo `VAE Safe Frame Padder`. +4. **Passthrough de Audio:** Lleva el cable `source_audio` desde el Explorador directamente hasta el puerto `audio` de tu `Incremental Auto-Stitcher` (al final del flujo). +5. **El Gatillo:** Conecta la salida de tu Stitcher al nodo `Loop Trigger (Auto-Queue)`. +6. **Ejecución:** Conecta el `Loop Start (Index)` al Cerebro y al Stitcher. +7. **Dispara:** Haz clic en "Queue Prompt" **UNA SOLA VEZ**. ¡Disfruta de la magia autónoma! -## 🧹 Auto-Limpieza y Desfragmentación Profunda de VRAM (NUEVO) -El entorno ahora implementa un blindaje anti-fragmentación de nivel forense, esencial para modelos masivos como WanVideo: -* **Secuencia Sagrada de Destrucción:** El nodo `VRAM Defragmenter` ejecuta una secuencia estricta de limpieza (Romper ciclos Python -> Evacuación Suave -> Descarga de Modelos -> Limpieza IPC -> Vaciado CUDA -> Sincronización de Hilos) para eliminar fragmentos huérfanos y prevenir *race conditions* asíncronas con kernels de Triton (como SageAttention). -* **Asignador de Memoria Bloqueado:** Se inyecta la variable de entorno `PYTORCH_CUDA_ALLOC_CONF="max_split_size_mb:128"` automáticamente al inicio para prohibir a PyTorch trocear bloques de VRAM mayores a 128 MB, garantizando bloques continuos masivos para los samplers. -* **Auto-Descarga del Explorador:** El nodo `VideoAnalyzerWithAudio` ahora incluye la opción `unload_detector` para destruir inmediatamente de la VRAM el modelo de detección facial una vez finalizado el escaneo, liberando espacio crítico antes de que comience la generación pesada. +--- -El nodo `SequentialLoopTrigger` además actúa como gestor de limpieza de cierre, forzando a ComfyUI a soltar todos los modelos pesados al terminar la generación del vídeo. ¡Esto asegura que tu gráfica vuelva a 0GB de uso, previniendo errores OOM! +## 🚀 Aceleración por GPU (Escaneo de Rostros) +El `VideoAnalyzerWithAudio` tiene un puerto `bbox_detector` para delegar el escaneo facial a la tarjeta gráfica: +1. Instala el *Impact Pack*. +2. Añade el nodo `UltralyticsDetectorProvider` y selecciona un modelo de rostros (ej. `face_yolov8m.pt`). +3. Conecta su salida al puerto del Analyzer. +*(El nodo cuenta con auto-descarga: destruirá este modelo de la VRAM al terminar para hacer hueco a la generación).* -**Changelog v1.5.4:** Implementación de "Secuencia Sagrada" de limpieza en `VRAM Defragmenter`, inyección de entorno anti-micro-fragmentación de PyTorch (`max_split_size_mb:128`), y auto-destrucción temprana del detector de rostros en el Analyzer. -**Changelog v1.5.3:** Se ha introducido un sistema de limpieza profunda automática de VRAM en el nodo `SequentialLoopTrigger`, garantizando que la memoria de la GPU (y RAM) se libere completamente tras la generación de videos pesados en arquitecturas CUDA, ROCm y Mac MPS. -**Changelog v1.5.2:** Instalación automatizada de FFmpeg, mejora crítica en el bypass del pre-flight check de ComfyUI para inputs dinámicos en el Analyzer, y exposición detallada de excepciones de torchaudio. +--- + +## 📝 Changelog Reciente +* **v1.6.0:** Implementación del `VAESafeFramePadder` (Hold Last Frame) y rediseño matemático a modo Expansión. Adiós a los recortes de audio y a los cuelgues en el ciclo final de WanVideo y LTX. +* **v1.5.4:** Inyección de la variable de entorno de PyTorch `max_split_size_mb:128` para evitar la micro-fragmentación de VRAM con kernels de Triton (SageAttention). Auto-descarga temprana de modelos YOLO. +* **v1.5.3:** "Secuencia Sagrada" en el VRAM Defragmenter (Romper ciclos -> Evacuación Suave -> Limpieza IPC -> Sincronización de hilos). diff --git a/README_EN.md b/README_EN.md index b0908d1..68026ea 100644 --- a/README_EN.md +++ b/README_EN.md @@ -1,78 +1,78 @@ # ♾️ ComfyUI Sequential Batcher -**v1.5.2** | **VRAM-Optimized Generation** | **Recursive Self-Queuing** +**v1.6.0** | **VRAM-Optimized Generation** | **Recursive Self-Queuing** | **Perfect Audio Sync** -A professional-grade suite of custom nodes for ComfyUI. Designed to bypass VRAM limitations in heavy video generation (WanVideo, Hunyuan, etc.) through **Recursive Self-Queuing** and autonomous, batch-by-batch processing. +A professional-grade suite of custom nodes for ComfyUI. Designed to bypass extreme VRAM limits in heavy video generation (WanVideo, Hunyuan, LTX) through **Recursive Auto-Queuing**, autonomous batch-by-batch processing, and forensic memory management. -> 🌍 **Leer en Español:** [README.md](README.md) +> 🇪🇸 **Leer en Español:** [README.md](README.md) + +--- + +## 🌟 What's New in v1.6.0 (Perfect Sync Update) +* **🛡️ VAE Safe Frame Padder (Hold Last Frame):** The engine now dynamically expands incomplete tensors at the end of the video. If frames are missing to meet the strict requirements of WanVideo (multiples of 4) or LTX (8n+1), it clones the last frame imperceptibly. **Result: Zero VAE crashes and 100% audio sync with no micro-stutters.** +* **📈 Mathematical Inversion to "Expansion":** The `AutoLoopCalculatorWan` and `AutoLoopCalculatorLTX` calculators now safely round the timeline upwards, guaranteeing total fluidity in intermediate cycles. --- ## ✨ Key Features -* **Autonomous Orchestration:** Turn your ComfyUI into a continuous rendering engine. Press "Queue" once and the workflow will feed itself until the entire video is finished. -* **Smart Chunking:** Analyzes the base video and performs mathematical cuts avoiding the separation of frames where faces are sharpest, thus maintaining identity coherence. -* **Native Audio Extraction:** Extracts the original audio track straight from the entry node and seamlessly injects it back into the final stitch. -* **Dual Input Engine:** The explorer node accepts both manually uploaded videos and dynamically injected string paths from downloaders (e.g., YTDLP), behaving exactly like VideoHelperSuite. -* **Native LTX 2.3 Support:** Specific mathematical calculators (`AutoLoopCalculatorLTX` and `ResTool64xLTX`) have been added to ensure video batches comply with the strict DiT architecture decompression rules and latent downscale factors (resolutions strictly divisible by 64 and frame partitions of `8n + 1`). +* **Autonomous Orchestration:** Turn your ComfyUI into a continuous rendering engine. Press "Queue Prompt" just once and the flow will feed itself by modifying seeds and indices until the entire video is finished. +* **Smart Chunking:** Analyzes the base video and makes mathematical cuts protecting the frames where faces are sharpest, maintaining identity coherence (Face Cuts). +* **Native Audio Extraction:** Extracts the original track directly from the initial node and injects it back into the final assembly. +* **DiT Architectures Support (WanVideo & LTX 2.3):** Specific mathematical calculators ensure video batches comply with strict decompression rules (multiples of 4 for WanVideo, or the `8n + 1` rule for LTX). +* **Protected Resolutions (Megapixel Shield):** Mathematical tools (`ResTool`) that automatically scale dimensions protecting the *training floor* of each base model. --- ## ⚠️ System Requirements (Critical) -For the `VideoAnalyzerWithAudio` node to unpack `.mp4` containers and extract audio via `torchaudio`, **FFmpeg is absolutely mandatory**. +For the `VideoAnalyzerWithAudio` node to unpack `.mp4` containers and extract audio with `torchaudio`, **FFmpeg is absolutely mandatory**. * **🐧 Ubuntu / Linux / WSL2:** - The ComfyUI Manager script will attempt to install it for you. If it fails, run: + The script will attempt to install it for you. If it fails, run manually: ```bash sudo apt update && sudo apt install ffmpeg -y ``` * **🪟 Windows:** - Download the pre-compiled binaries from FFmpeg and add the bin folder to your environment variables (PATH). + Download the precompiled FFmpeg binaries and add the `bin` folder to your environment variables (PATH). -## 🧠 The Hybrid Architecture (How it works) -Video processing is divided into highly specialized roles: +--- -* **🕵️ Video Analyzer Face detector + Audio (The Explorer):** Scans the video via OpenCV or through an optional GPU-accelerated YOLO/ONNX model for precise face detection, extracts the audio and outputs a visual Reference Frame. Acts as the main gateway. -* **📊 Auto Loop Calculator (The Brain):** Receives biometrics from the Explorer and calculates asymmetric cut coordinates (chunk_frames, skip_frames) featuring a ±10% dynamic margin to avoid residual micro-batches. -* **📊 Auto Loop Calculator (WanVideo 3dVAE):** An alternative for WanVideo that ensures frame chunks are strictly multiples of 4, protecting the 3D VAE from crashing. -* **🛠️ The Worker (VHS_LoadVideo):** Freed from analytical tasks, this standard ComfyUI node simply extracts the exact tensors the Brain commands. -* **🎞️ Incremental Auto-Stitcher (The Assembler):** Collects the rendered batches and the pristine original audio track, progressively stitching the final video. -* **📥 Session Image Receiver** and **📤 Session Image Sender:** Hold and pass the last valid keyframe (reference frame) across iterations to maintain temporal identity coherence. -* **⏱️ Auto FPS Limiter (The Synchronizer):** Prevents VRAM OOM errors on high framerate videos (e.g., 60 FPS) by automatically calculating the required frame skip (`select_every_nth`) and adjusting the final FPS to ensure audio and motion maintain perfect synchronization. -* **🔀 Master Switch (Lazy Evaluation and Graph Surgery):** Advanced logic node utilizing *Native Lazy Evaluation* in Cycle 0 and *Hot Graph Surgery* in subsequent cycles. It physically amputates inactive route wires from the JSON payload sent to ComfyUI, ensuring heavy nodes (like Lip Syncs or Upscalers) are not even loaded into memory when unneeded, resulting in massive VRAM savings. -* **Protected Resolutions (Megapixel Shield):** Mathematical resolution tools that scale dimensions to avoid artifacts by protecting the "training floor" of each model: - * **📐 ResTool 8x (SD1.5)** - * **📏 ResTool 16x (SDXL)** - * **🎞️ ResTool 32x (WanVideo)** - * **🎬 ResTool 64x (Hunyuan)** +## 🧠 The Hybrid Architecture (Node Breakdown) +Processing is divided into highly specialized roles: -## 🔌 Wiring Guide (Workflow Setup) -To build the perfect sequential workflow, follow these steps: +* **🕵️ Video Analyzer Face detector + Audio:** Scans the video via OpenCV or using a GPU-accelerated YOLO model. Extracts faces, audio, and the Reference Frame. +* **📊 Auto Loop Calculator (Base / WanVideo / LTX):** Receives the biometrics and calculates cut coordinates (chunk_frames, skip_frames). +* **🛡️ VAE Safe Frame Padder:** Intercepts the final VHS tensor and pads it by cloning the last frame if material is missing, saving the VAE from a collapse. +* **🎞️ Incremental Auto-Stitcher:** Collects rendered batches and the audio track, progressively stitching the final video in the temporary folder. +* **📥 Receiver & 📤 Sender:** Retain and transfer the last valid keyframe across cycles to maintain temporal coherence. +* **⏱️ Auto FPS Limiter:** Smartly reduces FPS guaranteeing audio and motion maintain perfect synchronization without breaking VRAM. +* **🔀 Master Switch (Lazy Evaluation):** Physically amputates wires from inactive routes in the JSON sent to ComfyUI. Heavy nodes not needed in a specific cycle aren't even loaded into memory. +* **🧹 VRAM Defragmenter:** Forensic memory purge (Sacred Sequence) that clears CUDA/MPS cache and forces the Garbage Collector between heavy cycles. -1. **Initial Setup:** Place the 🕵️ Video Analyzer Face detector + Audio at the beginning. Upload a video or connect a STRING cable to it from your favorite downloader. Optionally, connect an 'ONNX Detection Model Loader' node to its `bbox_detector` input for GPU face scanning. -2. **The Math:** Route total_frames and safe_faces_list from the Explorer into the 📊 Auto Loop Calculator (or 📊 Auto Loop Calculator (WanVideo 3dVAE) if using WanVideo). -3. **Extraction:** Add a VHS_LoadVideo node. Right-click on it -> Convert Widget to Input -> video. Connect the video_name from the Explorer to this new input. Feed the cutting parameters from the Brain. -4. **Audio Passthrough:** Route the source_audio cable from the Explorer all the way to the audio port of your 🎞️ Incremental Auto-Stitcher (at the end of your workflow). -5. **The Trigger:** Connect your Stitcher's output to the 🚀 Loop Trigger (Auto-Queue) input. -6. **Execution:** Wire the 🏁 Loop Start (Index) to the Brain and the Stitcher. Press "Queue Prompt" ONLY ONCE (do not check Auto Queue in the UI). Sit back and enjoy the autonomous magic! +--- -## 🚀 GPU Acceleration for Face Scanning (NEW) -The `VideoAnalyzerWithAudio` node now features an optional input port named `bbox_detector`. This allows you to offload facial scanning to your graphics card, massively multiplying the analysis speed. +## 🔌 Quick Wiring Guide (Workflow Setup) -**How to use it:** -1. Install the popular **Impact Pack**. -2. Add the `UltralyticsDetectorProvider` node to your canvas. -3. Select a face model (e.g., `bbox/face_yolov8m.pt`). -4. Connect the `BBOX_DETECTOR` output to the new input of our Explorer node. -*Note: If you leave this port unconnected, the node will seamlessly fall back to standard CPU scanning (OpenCV).* +1. **The Explorer:** Place the `Video Analyzer` at the beginning. Upload a video (or use a YTDLP path). +2. **Math:** Connect `total_frames` and `safe_faces_list` to your chosen `Auto Loop Calculator`. +3. **Safe Extraction:** Add the native `VHS_LoadVideo` node. Convert its input to *video_name* and connect it to the Analyzer. Connect its `IMAGE` output to the new `VAE Safe Frame Padder` node. +4. **Audio Passthrough:** Route the `source_audio` wire from the Explorer directly to the `audio` port of your `Incremental Auto-Stitcher` (at the end of the flow). +5. **The Trigger:** Connect the output of your Stitcher to the `Loop Trigger (Auto-Queue)` node. +6. **Execution:** Connect the `Loop Start (Index)` to the Brain and the Stitcher. +7. **Fire:** Click "Queue Prompt" **JUST ONCE**. Enjoy the autonomous magic! -## 🧹 Auto VRAM Cleanup (NEW) -The `SequentialLoopTrigger` node now acts as an intelligent cleanup manager. Once it detects that all frames have been processed and video generation has finished, it automatically: -1. Forces ComfyUI to release all heavy models from memory (WanVideo, VAE, etc.). -2. Triggers Python's garbage collector to eliminate residual memory in RAM. -3. Deeply empties PyTorch caches, supporting multiple platforms (CUDA/ROCm for NVIDIA/AMD, and MPS for Apple Silicon). +--- -This ensures your GPU returns to 0GB usage upon completion, preventing OOM errors in your subsequent generations! +## 🚀 GPU Acceleration (Face Scanning) +The `VideoAnalyzerWithAudio` has a `bbox_detector` port to delegate facial scanning to the graphics card: +1. Install the *Impact Pack*. +2. Add the `UltralyticsDetectorProvider` node and select a face model (e.g. `face_yolov8m.pt`). +3. Connect its output to the Analyzer's port. +*(The node features auto-unload: it will destroy this model from VRAM upon completion to make room for generation).* -**Changelog v1.5.3:** Introduced an automatic deep VRAM cleanup system within the `SequentialLoopTrigger` node, ensuring complete release of GPU (and RAM) memory after generating heavy videos across CUDA, ROCm, and Mac MPS architectures. -**Changelog v1.5.2:** Automated FFmpeg installation, critical enhancement on ComfyUI pre-flight check bypass for dynamic inputs in the Analyzer, and detailed exposure of torchaudio exceptions. \ No newline at end of file +--- + +## 📝 Recent Changelog +* **v1.6.0:** Implementation of `VAESafeFramePadder` (Hold Last Frame) and mathematical redesign to Expansion mode. Goodbye to audio cuts and crashes in the final cycle of WanVideo and LTX. +* **v1.5.4:** Injection of the PyTorch environment variable `max_split_size_mb:128` to avoid VRAM micro-fragmentation with Triton kernels (SageAttention). Early YOLO model auto-unload. +* **v1.5.3:** "Sacred Sequence" in the VRAM Defragmenter (Break cycles -> Soft Evacuation -> IPC Cleanup -> Thread Synchronization). diff --git a/__init__.py b/__init__.py index ad0c6d4..8c5ac04 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ import os if "PYTORCH_CUDA_ALLOC_CONF" not in os.environ: os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128" -__version__ = "1.5.1" +__version__ = "1.6.0" NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {}