-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
NSFW toggle, better context and character json #731
Conversation
This... seems like it's just a complicated way of toggling whether to add It also will conflict with #596 , a more general update to the SD API extension created by the same developer that originally made it. You might want to talk with @Brawlence to coordinate any improvements you're wanting. |
Experience indicates that having "sfw" / "nsfw" tags in (negative) prompt does not automatically guarantee the intended result. It influences the generation in the same way any other tag would, so I see no reason to make a separate checkmark for them when one can simply include it in prompt prefix. I like the proposed description request change for the interactive mode, here's mine so far: https://github.com/oobabooga/text-generation-webui/pull/596/files#diff-3918965e2a344d3e5543871949fc3c01353cf9e542d0d913c96f697a66de871aR103 I plan on isolating this logic for description requests eventually, so if you could re-write it as a function, that would help greatly. Same goes for parsing additional tags in character json; that's a brilliant idea, but I think it should be implemented in a separate helper function and not be done in |
The main reason to add the toggle for NSFW/SFW is mostly to be discreet. Right now I left just "nsfw" and "sfw" in the variable, but my thought was some people would want to populate those with things they want or don't want to have in the generation, without having them spelt visibly in the positive/negative prompt fields, directly in the UI. I feel like there's probably much better results possible using regex than the method I'm using for parsing the requests on the text-generation side prompt. The main difference in our answers is that I needed to add logic to detect when it's describing itself, to trigger the addition of the character json tags. After that though, I've still got troubles with my prompt; the main difficulty I keep having is with objects and clothing. Adding the character json tags helped greatly remind some of the limited models we're working with what they are supposed to look like, so I could offload that from the request, but I could not add impermanent characteristics (such as clothing and objects carried) to the character json as that would make them permanent (asking the model to send a picture of itself as a clown won't work as it will also add the permanent clothing in the SD request). Asking the model to describe its clothing/what it's holding works well, but asking it to describe its clothing AND a specific context or a specific action seems to overwhelms the ability to parse my question of Alpaca-7b on my machine and it just ignores one of the two parts (the description of its clothing or what it's holding or the context/action). Smarter models might be able to fix this entirely (and maybe even remove the need for the character json tags), but someone impatient or trying to support weak models could implement a way to offload tracking of objects to the webui side too; a sort of "inventory" of objects that get added or not to the SD-side prompt. Otherwise, maybe someone better at crafting a prompt can coax better results. I'll work on moving the tags processing to a separate function |
@GuizzyQC on the topic of loading the character features, there's an established format for description in character JSONs for TavernAI / KoboldAI, ex. 1, ex. 2 : It goes like Are you planning to support it or is your JSON syntax unrelated to that? |
I see the appeal in supporting the existing tag, but personally I find a precisely crafted SD prompt and text-generation prompt can differ, so I would keep them separated. There's also an added benefit to keeping them separate: having a section in the character json that's specifically to pass to SD allows it to have SD LoRAs or SD weighted tags. Those would confuse a language model if they were imported into the context. Even if it would be ignored by text-generation-webui, it would affect TavernAI and KoboldAI users if they imported characters with SD LoRAs in their context. It also means someone can work on their character's appearance in Automatic1111's SD UI and then copy-paste their prompt directly into their character JSON. Now that I think about it, it might also be worth adding a character json field for negative SD tags |
To the SD_Api_Pictures extension, added a NSFW toggle to avoid NSFW results when unwanted, added to parser the ability to understand non-self / non-environment objects and also added the ability to add tags to SD prompt loaded from the "for_sd" json tag, this allows characters to keep their appearance even if they're asked to describe something else than only themselves.