Giter Site home page Giter Site logo

Comments (8)

DominikDoom avatar DominikDoom commented on June 17, 2024 2

Yeah I'm aware, I do some complex prompts from time to time myself.
With my current WIP regex it would look like this:
image
Everything that is green was matched as a weighted tag, while brown tries to match "normal" tags. As you can see, it already works pretty well, even for nested tags - as long as they have no spaces, which is a limitation of all tags currently.

So when editing a tag that was already inserted, you'd have use underscores:
image
to still get a proper match. Maybe I'll automate or work around that in the future somehow, but for now it's out of scope.

With spaces ignored, it matches all of them as expected though, so I know the regex will also work for the future.
image
I just can't ignore them for now because I have no mechanism in place to search & insert tags with underscores or spaces seen as the same.

from a1111-sd-webui-tagcomplete.

DominikDoom avatar DominikDoom commented on June 17, 2024 1

Editing inside brackets should work now, as long as the hard-coding bug is fixed for you on the webui side.

chrome_2022-10-29_14-32-57.mp4

from a1111-sd-webui-tagcomplete.

DominikDoom avatar DominikDoom commented on June 17, 2024
  1. was fixed in 9fc9f1a (v1.6.0), so if you're on a version newer than that it should work (it does for me on the current version).
  2. This is a known issue currently. Since some tags can have parentheses or colons, a word inside them is not seen as a single tag without brackets, but tries to match the text including the parentheses and : separator. I could probably add a special check for that though. The reason it doesn't autocomplete after you clicked on it is because it looks for the word based on the cursor position, so since the cursor is not at the end of the word but after the space, it fails. But that it shows the list in that case after you typed a space seems to be a bug, I'll look into it.

from a1111-sd-webui-tagcomplete.

byzod avatar byzod commented on June 17, 2024
  1. was fixed in 9fc9f1a (v1.6.0), so if you're on a version newer than that it should work (it does for me on the current version).

Thanks for the confirm, after few test I found that it's a hardcode bug of webui's localization... this feature is not working at all with chinese localization ..I didn't realized that until now :/

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/35c45df28b303a05d56a13cb56d4046f08cf8c25/javascript/edit-attention.js#L4

It check if the placeholder has prompt, but in chinese it's 提示词, so always return false

  1. This is a known issue currently. Since some tags can have parentheses or colons, a word inside them is not seen as a single tag without brackets, but tries to match the text including the parentheses and : separator. I could probably add a special check for that though.

Parenthesis of correctly written tags are always escaped like Nero \(fate\), just ignore unescaped (wrong) parenthesis would make things easier

from a1111-sd-webui-tagcomplete.

DominikDoom avatar DominikDoom commented on June 17, 2024

Good to know, you should probably open an issue there for that bug if there isn't one already
Ah I see you already did that.

For 2 simply ignoring it sadly isn't an option because () aren't escaped yet if the user is still typing them, but I am currently working on the proper solution with a separate check for the (<tag>:<num>) weighting format. With that in place you should then be able to edit & complete tags in the weighting brackets like any other.

from a1111-sd-webui-tagcomplete.

byzod avatar byzod commented on June 17, 2024

Got it: AUTOMATIC1111/stable-diffusion-webui#3904

I don't know much about the parser thing so no more suggestions I could give :)

Don't forget that webui support complex syntax like this: (part of a real prompt from a friend)

(closeup:0.6) sweat [(loli:1):0.75] small breasts, wet (cumdrip pussy:1.2), 
[sketch | line art|charcoal ] [(watercolor:1.2):0.7] spot color by [(Jeremy Mann:1.4)::0.6] [(Akihiko Yoshida:1.4):0.4]

from a1111-sd-webui-tagcomplete.

byzod avatar byzod commented on June 17, 2024

With spaces ignored, it matches all of them as expected though, so I know the regex will also work for the future. I just can't ignore them for now because I have no mechanism in place to search & insert tags with underscores or spaces seen as the same.

It's worth noting that (cat ears:1.5) is (cat_ears:1.5), but (girl with cat ears:1.5) is not (girl_with_cat_ears:1.5), there's no way to tell the difference unless you search the tag in database all the time (will that be a performance hit?), nor you can tell user want to edit cat ears or girl with cat ears when they double click on cat

from a1111-sd-webui-tagcomplete.

DominikDoom avatar DominikDoom commented on June 17, 2024

Yeah, that is the big problem. I can't know where multi-word tags start or end, and searching for multiple pair combinations would be impossible due to performance reasons - trying out every combination would be:

  1. Matching every single tag
  2. Matching every combination of adjacent words
    a. For all groups size 2 to size n, where n is our total tag count.

That would put us at a complexity of O(cn) or worse, which gets out of hand really fast.

That's why I'm choosing to ignore it for now 😅
Finding a proper solution for that would only work in very restrictive circumstances, so I think it's fair game to require manual underscore replacement by the user on that part (or leaving replaceUnderscores off in the config, but that might lead to worse results for some models.

from a1111-sd-webui-tagcomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.