Nodes/ComfyUI-FairLab/Exclude Tags
ComfyUI Node

Exclude Tags

Strip the tags you don't want — Exclude Tags filters a comma-separated list

By yanhuifair·Created 2 years ago·Updated 3 months ago· 2
Exclude Tags
    • string
    string
    tags

    A shared workflow loads, you look at the positive prompt, and there they are: the five tags you never want - lowres, worst quality, or the exact character name that keeps dragging your generation sideways. Exclude Tags is the node that scrubs them out. Give it a comma-separated tag string plus a list of tags to remove, and it hands back the string minus anything that matched.

    It's part of a small tag-manipulation family in the pack - Append Tags merges and dedupes, Prepend Tags prefixes every tag, and this one filters. For anyone doing Danbooru-style tag prompting, this family replaces a lot of fiddly text surgery that the base distribution simply doesn't offer.

    The mechanism is in the source and it's about as predictable as it gets: split the input string on commas, split your exclude list on commas, and keep only the tags that don't appear in the exclude set, then rejoin with ", ". Both sides are whitespace-stripped before comparing, so a tag written as masterpiece with a trailing space still matches a cleanly-written masterpiece in your exclude list. That whitespace handling is the detail that makes it actually work on real-world prompts, where stray spaces are everywhere.

    One important difference from the pack's Append Tags node: Exclude Tags preserves order. It filters with a list comprehension rather than a set(), so the tags that survive come out in the same order you put them in. If tag order matters to your model, this is the safer node of the pair.

    The inputs:

    • string - the tag list to filter.
    • tags - the tags to remove; multiline text box, so you can list them one per line or comma-separated.

    The output:

    • string - the filtered tag list, wired straight into a CLIP Text Encode.

    Where it slots into a workflow: usually as a safety filter between a tag source and the text encoder - strip a banned character or a quality tag from a batch of prompts before they ever reach the model. If you're automating prompt batches, running everything through one Exclude Tags node means one place to edit your blocklist instead of hunting through every prompt string.

    Caveats are mild. Matching is exact after stripping, so 1girl won't match 1girls - write out the full tags you want gone. And it's case-sensitive, so Masterpiece and masterpiece are different tags to it. Both are easy to work around.

    Install is the standard pack path: ComfyUI Manager → search ComfyUI-FairLab → install → restart:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
    cd ComfyUI-FairLab
    pip install -r requirements.txt
    

    Restart and search "Exclude Tags" or "remove tags". No models, no extra dependencies - this one is pure string processing.

    CategoryFair/string

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING
    tagsSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING