Skip to content

Add Negative Prompt Feature#52

Merged
lkwq007 merged 1 commit intolkwq007:masterfrom
donlinglok1:feature/negative_prompt
Oct 7, 2022
Merged

Add Negative Prompt Feature#52
lkwq007 merged 1 commit intolkwq007:masterfrom
donlinglok1:feature/negative_prompt

Conversation

@donlinglok1
Copy link
Copy Markdown

@donlinglok1 donlinglok1 commented Oct 6, 2022

Hi, I am immensely enjoying your project.

However, I have heard that there is also a "Negative Prompt" that can be input.

I have checked the diffusers source #1 and diffusers source #2, and seems your project only need few change to implement it.

This request is my change and I have tested via colab.

Thanks again for your work!

@donlinglok1
Copy link
Copy Markdown
Author

Updates:

In current, the project are using diffusers==0.3.0, so diffusers source #1 is not valid,
the correct source code is diffusers source #3.

Therefore, only text2Img() can support negative_prompt for now, we will need for the next diffuser release (0.3.1?) to use negative_prompt on inpaint().

@lkwq007
Copy link
Copy Markdown
Owner

lkwq007 commented Oct 6, 2022

Seems that text2img also does not support the negative prompt with diffusers v0.3.0. Not sure when they will make the next release. https://github.com/huggingface/diffusers/blob/v0.3.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L94

@donlinglok1
Copy link
Copy Markdown
Author

Hum, you are right,

Although I can run the text2Img() + negative_prompt without any error.

But seems the negative_prompt didn't work correctly, I will do some tests again. Thank you for your reply!

@donlinglok1 donlinglok1 force-pushed the feature/negative_prompt branch 3 times, most recently from 8e3700e to 3ead225 Compare October 7, 2022 04:58
@donlinglok1 donlinglok1 closed this Oct 7, 2022
@donlinglok1 donlinglok1 force-pushed the feature/negative_prompt branch from 5273b92 to ab732e3 Compare October 7, 2022 05:03
@donlinglok1 donlinglok1 reopened this Oct 7, 2022
@donlinglok1
Copy link
Copy Markdown
Author

donlinglok1 commented Oct 7, 2022

Great news that diffusers just released 0.4.0 last night, I have tested the code in colab with test-case:

prompt=Bouquet of Roses
negative_prompt=red rose
image

@donlinglok1 donlinglok1 force-pushed the feature/negative_prompt branch from 279e8a0 to 1f86504 Compare October 7, 2022 05:32
@donlinglok1 donlinglok1 force-pushed the feature/negative_prompt branch from 89933a3 to 35b822d Compare October 7, 2022 06:05
@lkwq007
Copy link
Copy Markdown
Owner

lkwq007 commented Oct 7, 2022

Looks good to me.
Thanks for this timely PR!

@lkwq007 lkwq007 merged commit 0a4b36e into lkwq007:master Oct 7, 2022
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.

2 participants