mcmonkeyprojects / SwarmUI

SwarmUI (formerly StableSwarmUI), A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
MIT License
1.39k stars 101 forks source link

Autocompletion keywords are returned in a very Swarmy way #114

Closed Taruvi closed 2 months ago

Taruvi commented 3 months ago

Feature Idea

I've been using autocompletions in the Comfy tab via this node and it's been working great. However, in Swarm's Generate tab, after copying the exact same autocomplete file I was using in the Comfy tab, the autocompletions are listed in a different order.

This might not sound like much of a problem but let me explain it this way:

Imagine I'm building myself a prompt and I have an idea of what I want. Let's say that, as an example, one of the things I want is some sort of machine but I don't yet know what exact keywords I'd like to use. Just 'machine'...something, or something...'machine'.

In the comfy node, anything that matches the word I type is listed, along with the (I assume) popularity number.

comfy-autocomplete

In Swarm's autocomplete, the results are returned without the associated number and in a completely different order.

swarm-autocomplete

Why is this important? Plenty of models I've tested respond better to more popular tags. This is why I've been experimenting with Pony models. I have a higher success rate with models that are trained with more common tags than by letting the checkpoint try to sort itself out with guesswork.

In Comfy, I was using the numbers to help guide me to whichever tags seemed most likely to be understood by the model.

My feature request is to have the resulting keywords appear either:

  1. The keyword with a number to be displayed in the order of highest-lowest number.
  2. Have an option to return results in the order in which they appear in the autocompletion file if the file does not contain the numbers.

Regarding the second one, this file is the one I've been using. I'm using the exact same file in the exact same order for both Comfy and Swarm autocomplete but Swarm reorders the results. In the file itself, all tags are already sorted in order of highest number to lowest. If keywords are returned by autocomplete with the highest numbered ones first, then I can make an educated guess as to what I'm likely to have most success with.

Dare I say it: Swarm's keyword matching is a little bit too clever for this use case.

It would be icing on the cake if Swarm would also list the corresponding number (as in the Comfy node) so I'm aware of whether or not I'm trying to generate a barely used obscure tag.

Thanks.

Other

No response

mcmonkey4eva commented 3 months ago

Oh, that's a unique format I haven't seen before

https://raw.githubusercontent.com/DominikDoom/a1111-sd-webui-tagcomplete/main/tags/danbooru.csv is I think the same data (danbooru tags list) but in a format Swarm does support

I can add support for the other format.

And yes Swarm matching list is sorted by how good of a match it is rather than source order. I can add a user setting to disable the smarter matching logic if you don't like that

Taruvi commented 3 months ago

I just tried the file you mentioned and it does, indeed, show the numbers in Swarm's autocomplete as I'd hoped.

I didn't think there'd be much in it considering Swarm can already use different types (csv and txt) so I thought it was all supported. A quick look inside the files basically all look the same to me. Apparently not...

Yes, I would like to disable Swarm's sort order and use the results as they are returned as-is.

I've just checked that file and based upon a very quick search, the keywords do appear to be listed in highest number order first. So it should work for this file which is what I was wanting.

Thanks.

mcmonkey4eva commented 2 months ago

For what you requested, you'll want: image

or 'Frequency' on sort mode at your own preference