Commit Graph
29 Commits
Author SHA1 Message Date
Meisoftcoltd 3afcee2bef test: add safety guards and unit tests for video loop calculators
Added input validations (`source_frame_count <= 0` or `target_frames_per_loop <= 0`) to `AutoLoopCalculatorLTX` (in `loop.py`), and `AutoLoopCalculator`, `AutoLoopCalculatorWan` (in `video.py`). When conditions are met, a safe default is returned to prevent math domain errors. Also included a new comprehensive unit test suite in `tests/test_loop_calculator.py`.
2026-05-14 20:24:55 +00:00
Meisoftcoltd 6cd32fcfe9 Fix: Resolve Unit Clash between TTS chunks and video frames in Sequential Batcher
- Introduce `global_step_by_chunk` ghost variable initialized to `False` in `loop.py`
- Set `loop.global_step_by_chunk = True` in `AutoLoopCalculatorTTS` to indicate chunk mode
- Reset `loop.global_step_by_chunk = False` in video calculators (`AutoLoopCalculator`, `AutoLoopCalculatorWan`, `AutoLoopCalculatorLTX`) to ensure state resets
- Update `SessionImageSender.send_image` timeline management to branch logic, using `is_chunk_mode` to calculate progress differently for text chunks versus video frames
2026-05-13 22:34:58 +00:00
Meisoftcoltd 7f025b9a18 fix: remove destructive graph surgery in SequentialLoopTrigger
Replaced destructive `del inputs["on_true"]` and `del inputs["on_false"]` with simple state update `inputs["is_final_cycle"] = is_next_final` to rely on MasterSwitch's native lazy evaluation (`check_lazy_status`), fixing a `NodeInputError` bug during looping.
2026-05-09 11:27:29 +00:00
Meisoftcoltd 1f64452691 Fix estimated chunk size calculation for AutoLoopCalculatorTTS
Update `SequentialLoopTrigger` in `loop.py` to correctly identify
`AutoLoopCalculatorTTS` and set `estimated_chunk` to 1 instead of falling
back to a default of 50. This prevents the trigger from incorrectly guessing
when the final loop occurs and mutating the graph prematurely, which caused
errors during sequential TTS tasks.
2026-05-03 10:41:15 +00:00
Meisoftcoltd ecdda64169 ⚡ optimize: merge sequential loops in prompt iteration
Merged two sequential loops over `prompt.items()` in `SequentialLoopTrigger.trigger_next` into a single pass.
The first pass now simultaneously finds the `estimated_chunk` from `AutoLoopCalculator` and performs mutations for seeds and loop indices.
`MasterSwitch` mutations are deferred to a small secondary pass after `is_next_final` is calculated using the gathered chunk size.

This change reduces the overhead of iterating over large prompt dictionaries and yielded a ~26.8% performance improvement in synthetic benchmarks.
2026-05-02 20:45:27 +00:00
Meisoftcoltd d660a6b41b Refactor loop calculators to prioritize scene cuts over face cuts\n\n* Added SCENE_CUTS type to VideoAnalyzerSceneDetector.\n* Replaced "safe_faces_list" usage in loop calculators with "scene_cuts_list" as priority.\n* Removed dead code/scripts: update_video.py, fix_newlines.py, fix_tqdm.py, add_scenedetector.py. 2026-04-25 12:20:48 +00:00
Meisoftcoltd 444b6c6513 Fix VAE frame loss by forcing timeline completion on final chunk and optimize stitcher RAM via lightweight PNG caching. 2026-04-12 16:10:56 +00:00
Meisoftcoltd 0d794fc10e fix: decouple timeline from frame padding to prevent EOF crashes
Replaced artificial safe limit in AutoLoopCalculatorWan (video.py) and
AutoLoopCalculatorLTX (loop.py) with actual physical source frame limit.
This prevents trigger nodes from falsely requesting frames past the EOF
which resulted in "RuntimeError: No frames generated".
2026-04-12 10:26:08 +00:00
Meisoftcoltd 1b75c40e3e feat: add VAESafeFramePadder and update loop calculators math
- Added VAESafeFramePadder to `tools.py` which clones the last frame
  of an image tensor to satisfy mathematical rules (4n for WanVideo,
  8n+1 for LTX) avoiding audio clipping and VAE crashes.
- Registered the new tool in `__init__.py` under NODE_DISPLAY_NAME_MAPPINGS.
- Updated `AutoLoopCalculatorWan` in `video.py` to pad and round up to a
  multiple of 4.
- Updated `AutoLoopCalculatorLTX` in `loop.py` to pad and round up to an
  8n+1 multiple.
2026-04-12 01:33:46 +00:00
Meisoftcoltd 9e893334a1 Fix final batch race condition by delegating global counter reset
Removes the zeroing of `global_loop_index` and `global_accumulated_frames` from the `SequentialLoopTrigger` node.
This architectural shift solves a race condition where the stitcher would process the final chunk based on freshly reset counters (0) instead of the actual completed value, resulting in empty frames or structural bypassing. State cleanup is now exclusively handled by the entry start node.
2026-04-11 17:16:12 +00:00
Meisoftcoltd 63e84c2aa1 Fix Micro-Cycle Death Loops in frame calculation
This commit patches the `SessionImageSender`, `AutoLoopCalculatorWan`,
and `AutoLoopCalculatorLTX` nodes to prevent infinite loops caused by
extreme truncation at the end of video sequences.

- `image.py`: Ensures `SessionImageSender` accepts the entire batch if no
  faces are detected, rather than defaulting to frame 0, which previously
  trapped the workflow in a 1-frame micro-cycle loop.
- `video.py`: Updates `AutoLoopCalculatorWan` to always round the final
  chunk size up to the nearest multiple of 4, removing the strict
  cropping logic that broke the 3D VAE rule.
- `loop.py`: Updates `AutoLoopCalculatorLTX` to always round the final
  chunk size up to the nearest `8n + 1` value, removing the strict
  cropping logic that broke the DiT rule.
2026-04-08 21:22:08 +00:00
Meisoftcoltd 1e36f9e915 feat: implement VRAM defragmentation strategy and optimization
- Created `MeisoftVRAMDefragmenter` in `vram_node.py` as a passthrough to force model unloading, Python garbage collection, and CUDA cache defragmentation.
- Registered the new node in `__init__.py`.
- Added light memory cleanup on intermediate batch loops in `loop.py`, alongside a heavy cleanup (including ctypes `malloc_trim`) at the end.
- Added `unload_detector_after_analysis` boolean flag to `VideoAnalyzerWithAudio` in `video.py` to allow releasing the BBOX detector model immediately after use.
2026-04-08 07:48:48 +00:00
Meisoftcoltd ff5643b098 feat: add MasterSwitch node with lazy evaluation and graph surgery
- Implement `switch_node.py` with `MasterSwitch` handling native lazy evaluation.
- Register `MasterSwitch` in `__init__.py` using clean names.
- Intercept and apply Hot Graph Surgery in `loop.py` to strip out unneeded nodes in auto loop cycles for reduced VRAM usage.
2026-04-07 19:23:01 +00:00
Meisoftcoltd 608be49841 fix: Silence YOLO outputs and improve transparency in calculators 2026-04-05 17:03:15 +00:00
Meisoftcoltd a5db690cdf feat: implement proportional adjustment logic for AutoLoopCalculators
- Patches `AutoLoopCalculator` in `video.py` to add base proportional adjustment without VAE constraints.
- Patches `AutoLoopCalculatorLTX` in `loop.py` to enforce the strict 8n + 1 frame rule for LTX models, matching its calculation mathematically correctly for proportional chunking.
- Fixes `__pycache__` to be excluded correctly.
2026-04-05 09:36:44 +00:00
Meisoftcoltd 1ffccc5599 feat: add native support for LTX 2.3 model
- Implemented `AutoLoopCalculatorLTX` node to enforce `8n + 1` frame chunks.
- Added `ResTool32xLTX` node for strict 32x divisible resolutions with proper minimum pixel scaling.
- Updated `IncrementalVideoStitcher` (in `image.py`) to correctly subtract the overlapping anchor frame from global frame progression when LTX mode is active.
- Added `global_ltx_mode` reset in `SequentialLoopStart` to prevent state leakage to other non-LTX workflows.
- Registered nodes in `__init__.py` and updated `README.md` & `README_EN.md` with new features.
2026-04-03 13:00:41 +00:00
Meisoftcoltd 762ed08324 feat: implement Fail-Fast mechanism for sequential loop port verification
- Moved port configuration from `SequentialLoopTrigger` to `SequentialLoopStart` to act as the single source of truth.
- Added a pre-flight check in `SequentialLoopStart` that pings the ComfyUI API endpoint `/system_stats` with a 2-second timeout.
- Aborts workflow execution immediately via `ValueError` if the port is incorrect or unreachable, saving hours of processing time by failing fast instead of at the end of the batch.
- Configured `SequentialLoopTrigger` to silently read `global_server_port` rather than requiring it as a node input.
- Ensured console debug logs remain cleanly formatted in Spanish to match user expectations.
2026-04-02 07:45:54 +00:00
Meisoftcoltd 9fa6057024 feat: Implementar limpieza extrema de VRAM automática en SequentialLoopTrigger
- Añadir las dependencias gc, torch y comfy.model_management en loop.py.
- Implementar vaciado profundo de VRAM al finalizar la generación de frames en el método trigger_next.
- Asegurar reinicio del contador global_accumulated_frames.
- Incluir soporte multiplataforma para el vaciado de cachés de PyTorch (CUDA, ROCm y MPS para Mac).
2026-04-02 07:05:16 +00:00
Meisoftcoltd 1c13d37fbc feat: implement Dynamic Engine and Tools suite for v1.5.0
This commit introduces the Hybrid Identity Architecture's Dynamic Engine:
- `tools.py`: Adds new Math constraint nodes (`ResTool 8x, 16x, 32x, 64x`) to calculate safe resolutions dynamically, preventing VRAM overflow.
- `loop.py`: Replaces the legacy static mathematical state machine with a dynamic performance-based state using `global_accumulated_frames` to progress accurately based on successful generations.
- `image.py`: Overhauls `SessionImageSender` to dynamically truncate generated image tensors using OpenCV if faces are lost, saving the last valid frame, and correctly adjusting the loop progression. `SessionImageReceiver` updated to log dynamic progression.
- `video.py`: Refactors `AutoLoopCalculator` and `IncrementalVideoStitcher` to work under the new dynamic state machine logic.
- `__init__.py`: Registered new nodes, updated imports to include `tools`, and bumped version to v1.5.0.
- `README.md` & `README_EN.md`: Updated documentation to detail the new Dynamic Engine functionality and Tools suite.
2026-03-30 19:03:16 +00:00
Meisoftcoltd bb703951d5 feat: Implement lazy evaluation Cycle 0 architecture
- Introduced global state memory (`global_source_frame_count`, `global_target_frames`, `global_stride`) in `loop.py`.
- Removed visual `source_frame_count` wire from `AutoLoopCalculator` in `video.py`
- Upgraded `AutoLoopCalculator` to execute as a blind "Explorer" in Cycle 0.
- Updated `LoadVideoWithSourceAudio` to intercept real `source_frame_count` directly from VHS payloads.
- Added dynamic calculation of total cycles based on intercepted frames at the end of Cycle 0.
2026-03-29 16:08:21 +00:00
Meisoftcoltd d6d29f998e feat: Add AutoLoopCalculator and remove circular loop wires\n\n- Replace WanFrameValidator with AutoLoopCalculator in video.py\n- Introduce global_total_loops in loop.py to track loops implicitly\n- Eliminate total_loops parameter from SequentialLoopStart, SequentialLoopTrigger, IncrementalVideoStitcher, SessionImageReceiver, and SessionImageSender to prevent ComfyUI wire clutter and avoid circular dependencies.\n- Add support for striding (select_every_nth) in frame distribution calculations.\n- Update README.md and README_EN.md to match the new architecture. 2026-03-29 14:58:28 +00:00
Meisoftcoltd 7c858643e6 feat: v1.2.0 global update for Sequential Batcher nodes
- Update WanFrameValidator to dynamically calculate skip_frames based on current_loop_index.
- Update LoadVideoWithSourceAudio to extract and output the first frame safely.
- Add total_loops tracking and detailed debug logs to SequentialLoopStart.
- Add total_loops to SessionImageReceiver and SessionImageSender for progressive tracking.
- Enhance print logs with visible Spanish banners across modified nodes.
2026-03-28 22:12:23 +00:00
Meisoftcoltd e87cad300c feat: add explicit input validations to key nodes
- `loop.py`: Added check for `trigger_dependency` in `SequentialLoopTrigger.trigger_next`.
- `image.py`: Added checks for `generated_images` and `current_loop_index` in `SessionImageSender.set_image`.
- `video.py`: Added list-aware checks for `trigger` and `current_loop_index` in `IncrementalVideoStitcher.stitch_incremental` due to `INPUT_IS_LIST = True`.

All validations throw a `ValueError` with clear Spanish instructions when inputs are missing to provide immediate user feedback on the ComfyUI canvas.
2026-03-23 20:49:22 +00:00
Meisoftcoltd 9939314b2f Fix loop reverse cache with payload mutation and add debug logic
Replaced loop.py and image.py, and updated video.py to fix the 'reverse cache'
issue by injecting the new index directly into the ComfyUI API JSON payload.
Added large debug banners in Spanish, PNG keyframe extraction, and progressive MP4 saving.
2026-03-23 19:55:57 +00:00
Meisoftcoltd 4d18b4e69d Implement Seed Mutator in SequentialLoopTrigger to break ComfyUI cache
- Replaced existing SequentialLoopTrigger logic.
- Added dictionary scanning to intercept the queue POST JSON payload.
- Injects a new 32-bit random integer (`0xffffffff` max) into any node possessing `seed` or `noise_seed` in its inputs.
- Preserves the sequential auto-queue logic but now guarantees the sampler processes a new generation instead of instantly returning cached results in subsequent loops.
2026-03-23 17:24:12 +00:00
Meisoftcoltd 29915698e5 Fix: Update cache breaking logic in IS_CHANGED from NaN to time.time()
This resolves aggressive caching bugs in newer ComfyUI versions.
Replaced float("NaN") with time.time() in image.py and loop.py
to ensure stateful memory/trigger nodes consistently fire.
2026-03-22 22:17:23 +00:00
Meisoftcoltd 73581ac582 refactor: clean up repository to v1.0.0 and implement recursive self-queuing architecture
- Delete deprecated modules: `sequence.py`, `paths.py`, `batch.py`, `debug.py`.
- Clean `image.py`, retaining only SessionImageReceiver, SessionImageSender, and auxiliary function.
- Clean `video.py`, retaining only IncrementalVideoStitcher and WanFrameValidator.
- Clean `loop.py`, retaining only SequentialLoopStart and SequentialLoopTrigger.
- Rewrite `__init__.py` mapping explicitly to the 6 core components and bump version to 1.0.0.
2026-03-22 19:25:11 +00:00
Meisoftcoltd 6da4275975 feat: implement recursive self-queuing nodes for autonomous execution
- Add `SequentialLoopStart` and `SequentialLoopTrigger` nodes in `loop.py`.
- Manage global loop index for memory persistence across cycles.
- Implement auto-queue HTTP POST trigger using local ComfyUI API `/prompt`.
- Add non-blocking timeout of 5s on urllib requests.
- Register new nodes in `__init__.py` under NODE_DISPLAY_NAME_MAPPINGS.
2026-03-22 19:12:43 +00:00
Meisoft ecc6836a41 Add files via upload 2026-01-26 03:32:33 +01:00