Skip to content

Commit 6c4320a

Browse files
author
Grzegorz Pluto-Prondzinski
authored
Add validation ensuring negative_prompt_embeds is not None when CFG is enabled (#2351)
1 parent 1e3a62f commit 6c4320a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

optimum/habana/diffusers/pipelines/wan/pipeline_wan_i2v.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ def __call__(
453453
if negative_prompt_embeds is not None:
454454
negative_prompt_embeds = negative_prompt_embeds.to(transformer_dtype)
455455

456+
if self.do_classifier_free_guidance and negative_prompt_embeds is None:
457+
raise ValueError("negative_prompt_embeds must not be None when classifier-free guidance is enabled.")
458+
456459
# only wan 2.1 i2v transformer accepts image_embeds
457460
if self.transformer is not None and self.transformer.config.image_dim is not None:
458461
if image_embeds is None:

0 commit comments

Comments
 (0)