mix1009 / model-keyword

Automatic1111 WEBUI extension to autofill keyword for custom stable diffusion models and LORA models.
MIT License
248 stars 13 forks source link

Support for negative prompt additions in addition to postive #15

Open iarna opened 1 year ago

iarna commented 1 year ago

I have some models that only behave properly with some additional negative prompts. I've patched my local copy to allow me to add both positive and negative prompts -- would you be interested in getting a PR for this change?

mix1009 commented 1 year ago

That's a very good idea. Are the negative for each keyword? How did you encode the negative prompt? I think it should be encoded in the keyword(s).

Example for https://civitai.com/models/2856/synthpunk-search :

Original keywords: SWPUNK|SYNTHWAVEPAINT|SPLATTERS

Keywords with negative prompts (deforum style negative prompt) SWPUNK --neg watermark|SYNTHWAVEPAINT --neg blurry|SPLATTERS

Do you have better idea for encoding the negative prompts?

Thank you.

mix1009 commented 1 year ago

@iarna Are you working on it? If not, I could implement it. Thank you.

iarna commented 1 year ago

Ok so yeah, I do have this largely implemented. This is how I approached it:

I added another field to the CSV (inserted just after the existing field) that contains the negative prompt. It's added to the user's negative prompt in the same way that the positive prompt is currently handled. (It does this in such a way that it can load current data files so it'll be fully backwards compatible for existing custom entries. It also maintains the existing format if no negative prompt was added so in that respect it's also forward compatible.)

Remaining to be done on this is adding the input box in the UI for the negative prompt.

mix1009 commented 1 year ago
  1. If there is multiple keywords, is the negative prompt for each keyword, or is it per model?
  2. The current csv format is variable in length. the third column(ckpt name) is optional. This will make adding new column harder.

So I'd prefer embedding the negative prompt in the keywords(second column) without adding a new column to the csv file.

scruffynerf commented 1 year ago
  1. If there is multiple keywords, is the negative prompt for each keyword, or is it per model?
  2. The current csv format is variable in length. the third column(ckpt name) is optional. This will make adding new column harder.

So I'd prefer embedding the negative prompt in the keywords(second column) without adding a new column to the csv file.

I'd prefer (for the sale of consistency) if the negatives were just folded in, with a marker at the front like "neg*"... This would allow the random/multiple stuff to work consistently as now. If you added all, it would add all negative prompts, if you add one or two, it would handle the prefix and put it into the negative prompt.

I agree, making a new column makes less sense.

tdtrumble commented 6 months ago

Bumping this, it would be a really helpful addition. @iarna, is this implemented in your fork? I did a quick glance at the code and it doesn't seem like its doing anything with a negative prompt, but did I just not look hard enough?