Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding negative prompts to Loras in extra networks #14475

Merged
merged 4 commits into from
Dec 31, 2023

Conversation

Learwin
Copy link
Contributor

@Learwin Learwin commented Dec 30, 2023

Description

This pull request adds the ability to specify a negative prompt with weight that will be added alongside the prompt to their respective texbox, when clicking a lora card in the extra networks tab. If nothing is specified no additional text will be added to the negative prompts.

To achieve this I modified ui_edit_user_metadata.py, ui_extra_networks_lora.py and ui_extra_networks.py to incorporate these two new fields. I also had to modify extraNetworks.js to allow the prompt and negative prompt to be added at the same time. Additionally I had to add additional regex expressions to match the negative prompt that gets added by clicking on the card.
The two new fields are saved into the models json file.

Screenshots/videos:

grafik

negative_prompt_example

Checklist:

@AUTOMATIC1111
Copy link
Owner

  1. I don't think the slider is needed; user can put (:0.7) into his text himself if he needs that.
  2. Is this functionality even needed? Are there loras that recommend negative prompt?
  3. Does the implementation interfer with the normal functionality of textual inversion tab where you can cloose what prompt tp add text to, by just selecting that prompt?

@Learwin
Copy link
Contributor Author

Learwin commented Dec 31, 2023

  1. Yeah the slider is suboptimal, I agree. I can remove if you want.
  2. While not extremely common I've definitely come across a few loras that suggested using certain negative prompts.
  3. No it does not interfere. Textual inversion prompt will still be added to the active textarea. I've tried to make sure that every existing functionality was kept the same.

@AUTOMATIC1111
Copy link
Owner

All right, remove the slider and let's get it in.

@Learwin
Copy link
Contributor Author

Learwin commented Dec 31, 2023

Removed the slider and also removed the changes to an unrelated file that must have been changed while I used the python linter.

@AUTOMATIC1111 AUTOMATIC1111 merged commit f3af8c8 into AUTOMATIC1111:dev Dec 31, 2023
3 checks passed
@w-e-w w-e-w mentioned this pull request Feb 17, 2024
@pawel665j pawel665j mentioned this pull request Apr 16, 2024
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