From 233572728ee71369f61718b8b1f3c539e802ea53 Mon Sep 17 00:00:00 2001 From: SajeelHaider Date: Tue, 2 Jun 2026 21:19:08 +0500 Subject: [PATCH] fix: return correct tuple size from predict_with_cfg zero-init early-exit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `use_cfg_zero_star + use_zero_init` early-exit path in `predict_with_cfg` returned a 2-tuple while all callers unpack 3 values (nodes_sampler.py) or expect the cache state (skyreels/nodes.py), causing `ValueError: not enough values to unpack` on the first sampling step when both options are enabled. Pass through `cache_state`/`teacache_state` unchanged — at the zero-init step there is no cache update, so returning the input state is the correct identity behavior. Fixes #2010 --- nodes_sampler.py | 2 +- skyreels/nodes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes_sampler.py b/nodes_sampler.py index 32b51c6a..dac368fb 100644 --- a/nodes_sampler.py +++ b/nodes_sampler.py @@ -1182,7 +1182,7 @@ def predict_with_cfg(z, cfg_scale, positive_embeds, negative_embeds, timestep, i with torch.autocast(device_type=mm.get_autocast_device(device), dtype=dtype) if autocast_enabled else nullcontext(): if use_cfg_zero_star and (idx <= zero_star_steps) and use_zero_init: - return z*0, None + return z*0, None, cache_state nonlocal patcher current_step_percentage = idx / len(timesteps) diff --git a/skyreels/nodes.py b/skyreels/nodes.py index a188edea..c41622f8 100644 --- a/skyreels/nodes.py +++ b/skyreels/nodes.py @@ -457,7 +457,7 @@ def predict_with_cfg(z, cfg_scale, positive_embeds, negative_embeds, timestep, i with torch.autocast(device_type=mm.get_autocast_device(device), dtype=dtype, enabled=("fp8" in model["quantization"])): if use_cfg_zero_star and (idx <= zero_star_steps) and use_zero_init: - return latent_model_input*0, None + return latent_model_input*0, teacache_state nonlocal patcher current_step_percentage = idx / len(init_timesteps)