diffusers
b62614a9 - Fix NameError in ZImageOmniPipeline when guidance_scale=0 (#13527)

Commit
4 days ago
Fix NameError in ZImageOmniPipeline when guidance_scale=0 (#13527) `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).
Author
Parents
Loading