Commit 56a6219
committed
Fix NameError in ZImageOmniPipeline when guidance_scale=0
`ZImageOmniPipeline.__call__` only defines `negative_condition_siglip_embeds`
inside a `if self.do_classifier_free_guidance:` block:
if self.do_classifier_free_guidance:
negative_condition_siglip_embeds = [
[se.clone() for se in batch] for batch in condition_siglip_embeds
]
but later reads the name unconditionally when reshaping:
condition_siglip_embeds = [None if sels == [] else sels + [None] for sels in condition_siglip_embeds]
negative_condition_siglip_embeds = [
None if sels == [] else sels + [None] for sels in negative_condition_siglip_embeds
]
`do_classifier_free_guidance` is defined as `self._guidance_scale > 0`,
so any call with `guidance_scale=0.0` raises `NameError`. This is the
exact configuration the pipeline's own `EXAMPLE_DOC_STRING` uses
(`guidance_scale=0.0` for the Z-Image-Turbo distilled checkpoint),
so running the documented snippet crashes.
The downstream consumption at
condition_siglip_embeds_model_input = condition_siglip_embeds + negative_condition_siglip_embeds
is already guarded by `if apply_cfg:`, so we only need to guard the
reshape step to match. Wrap the negative-branch list comprehension in
the same CFG check, matching the symmetric treatment of
`negative_condition_latents` (which is already only defined when
`do_classifier_free_guidance` is true and used only in the CFG branch
of the denoise loop).1 parent f7fd76a commit 56a6219
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
592 | | - | |
593 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
| |||
0 commit comments