From 745b6beb3d0b0f9392539f3def0142a268989d3d Mon Sep 17 00:00:00 2001 From: laurigates <13014001+laurigates@users.noreply.github.com> Date: Thu, 7 May 2026 14:53:55 +0300 Subject: [PATCH] fix: return 3-tuple from predict_with_cfg use_zero_init early-exit The CFG-Zero* early-exit path returned a 2-tuple while every caller (and every other return in predict_with_cfg) unpacks 3 values: (noise_pred, noise_pred_ovi, cache_state). Workflows that enable both cfg_zero_star and use_zero_init crash on step 0 with "ValueError: not enough values to unpack (expected 3, got 2)". Pass cache_state through unchanged - at the zero-init step there is no cache update to record, so returning the input cache state is the natural identity. Same shape of bug as #1454 (HUMO branch), different code path. Fixes #2010 --- nodes_sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes_sampler.py b/nodes_sampler.py index 4dc208fe..e10d8332 100644 --- a/nodes_sampler.py +++ b/nodes_sampler.py @@ -1176,7 +1176,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)