Skip to content

Conversation

@brucew4yn3rp
Copy link

@brucew4yn3rp brucew4yn3rp commented Jun 21, 2025

@pythongosssss

The ComfyUI WD14 node uses the WD14 tagging models which often give redundant tags (e.g., they output both gloves and fingerless gloves or shirt and white shirt) so I threw this together to resolve some of that. Adding it into the async tag function helps clean up the output tremendously.

Removing exact duplicates

unique_tags = {}
    for tag, score in filtered:
        if tag not in unique_tags or score > unique_tags[tag]:
            unique_tags[tag] = score

    deduped = list(unique_tags.items())

Removing substrings

specific_tags = []
    for tag, score in deduped:
        is_subsumed = False
        for other, _ in deduped:
            if tag != other and tag in other and len(other) > len(tag):
                is_subsumed = True
                break
        if not is_subsumed:
            specific_tags.append((tag, score))

Additionally, the async tag definition was strangely hardcoding values that should be overridden by the user settings such as threshold, character threshold, exclude tags, etc. These now reference the defaults.

@brucew4yn3rp
Copy link
Author

@pythongosssss Following up to see if you had a chance to take a look at this?

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.

1 participant