Unverified Commit 3393c01c authored by Vladimir Mandic's avatar Vladimir Mandic Committed by GitHub
Browse files

fix pixart-sigma negative prompt handling (#8299)



* fix negative prompt

* fix

---------
Co-authored-by: default avataryiyixuxu <yixu310@gmail,com>
Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
parent 1fa8dbc6
...@@ -394,7 +394,7 @@ class PixArtAlphaPipeline(DiffusionPipeline): ...@@ -394,7 +394,7 @@ class PixArtAlphaPipeline(DiffusionPipeline):
# get unconditional embeddings for classifier free guidance # get unconditional embeddings for classifier free guidance
if do_classifier_free_guidance and negative_prompt_embeds is None: if do_classifier_free_guidance and negative_prompt_embeds is None:
uncond_tokens = [negative_prompt] * batch_size uncond_tokens = [negative_prompt] * batch_size if isinstance(negative_prompt, str) else negative_prompt
uncond_tokens = self._text_preprocessing(uncond_tokens, clean_caption=clean_caption) uncond_tokens = self._text_preprocessing(uncond_tokens, clean_caption=clean_caption)
max_length = prompt_embeds.shape[1] max_length = prompt_embeds.shape[1]
uncond_input = self.tokenizer( uncond_input = self.tokenizer(
......
...@@ -320,7 +320,7 @@ class PixArtSigmaPipeline(DiffusionPipeline): ...@@ -320,7 +320,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
# get unconditional embeddings for classifier free guidance # get unconditional embeddings for classifier free guidance
if do_classifier_free_guidance and negative_prompt_embeds is None: if do_classifier_free_guidance and negative_prompt_embeds is None:
uncond_tokens = [negative_prompt] * batch_size uncond_tokens = [negative_prompt] * batch_size if isinstance(negative_prompt, str) else negative_prompt
uncond_tokens = self._text_preprocessing(uncond_tokens, clean_caption=clean_caption) uncond_tokens = self._text_preprocessing(uncond_tokens, clean_caption=clean_caption)
max_length = prompt_embeds.shape[1] max_length = prompt_embeds.shape[1]
uncond_input = self.tokenizer( uncond_input = self.tokenizer(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment