Skip to content

fix: return 3-tuple from predict_with_cfg use_zero_init early-exit#2011

Open
laurigates wants to merge 1 commit into
kijai:mainfrom
laurigates:fix/predict-with-cfg-zero-init-tuple
Open

fix: return 3-tuple from predict_with_cfg use_zero_init early-exit#2011
laurigates wants to merge 1 commit into
kijai:mainfrom
laurigates:fix/predict-with-cfg-zero-init-tuple

Conversation

@laurigates
Copy link
Copy Markdown

Fixes #2010.

The CFG-Zero* early-exit in predict_with_cfg returned a 2-tuple while every caller (and every other return in the same function) unpacks 3 values: (noise_pred, noise_pred_ovi, cache_state). Workflows that enable both cfg_zero_star and use_zero_init on WanVideoExperimentalArgs crash on step 0 with:

ValueError: not enough values to unpack (expected 3, got 2)

Same shape of bug as #1454 (HUMO branch), different code path that escaped that fix.

Change

 if use_cfg_zero_star and (idx <= zero_star_steps) and use_zero_init:
-    return z*0, None
+    return z*0, None, cache_state

cache_state is passed through unchanged — at the zero-init step there is no actual cache update to record, so returning the input cache state is the natural identity. I have been running this patch locally on a Wan 2.2 14B I2V workflow with cfg_zero_star=true, use_zero_init=true and it produces correct output (step 0 noise prediction is zeroed as the CFG-Zero* design intends, subsequent steps proceed normally).

Test plan

  • Reproduced the crash on main with WanVideoExperimentalArgs(cfg_zero_star=true, use_zero_init=true) wired into WanVideoSamplerv2.extra_args via WanVideoSamplerExtraArgs.
  • Applied the patch and re-ran the same graph end-to-end without error.
  • Verified all other returns in predict_with_cfg are 3-tuples.

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 kijai#1454 (HUMO branch), different code path.

Fixes kijai#2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

predict_with_cfg use_zero_init early-exit returns 2-tuple, callers expect 3-tuple

1 participant