Remove Duplicate Tags [LP]
Cleaning up an assembled tag string
- tags TEXT
If you prompt with Danbooru-style tags - the comma-separated vocabulary that Illustrious, NoobAI, and other anime-trained checkpoints expect - you've probably ended up with a prompt string built from more than one source: a character sheet's tags, a LoRA's recommended trigger words, a style template you copy-pasted from somewhere. Stack enough of those together and duplicates creep in. This node's job is to clean that up: feed it a tag string, get back the same tags with repeats collapsed.
Why duplicates are worth removing, not just harmless clutter
In tag-based prompting, earlier tags in the string generally get stronger weight, and a tag repeated later in the string doesn't meaningfully reinforce it - it mostly just eats space that could've gone to a tag you actually needed. If you're already fighting to keep a prompt focused, a duplicate masterpiece or a repeated character tag buried three sources deep in your template isn't pulling its weight. Cleaning duplicates before the prompt ships keeps the signal-to-noise ratio in your favor, especially in automated pipelines where tags get concatenated from several places without a human eyeballing the final string.
The inputs and outputs that matter
- text - a multiline STRING field, the full tag string you want cleaned.
- Output - labeled
tags TEXTin the node's own schema, a STRING with duplicates removed.
That's the whole surface: one text box in, one cleaned text box out. There's no separator setting or case-sensitivity toggle exposed, so treat it as working on however your tags are already delimited (comma-separated is the standard convention this style of prompting uses).
How to install it
ComfyUI Manager: search "ComfyUI Level Pixel" or ComfyUI-LevelPixel, install, restart - pulls updates automatically via Manager's "Update ALL." Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
Restart ComfyUI. Pure text processing, no models, nothing else needed.
Common issues & troubleshooting
A duplicate you can clearly see in the prompt didn't get removed. The most likely cause is that the two occurrences aren't actually identical strings to an exact-match comparison. blue_sky and blue sky (underscore vs. space), or 1girl and 1Girl (casing), read as different tags even though they mean the same thing to you. Normalize casing and spacing upstream - a text-replace step before this node - if your tag sources are inconsistent about formatting.
You want to remove specific tags, not just duplicates. This node only dedupes; it doesn't know which tags you actually want gone. Pair it with the pack's TagRemover-LP node, which takes an explicit list of tags to exclude - run tags through both in sequence when you're assembling a prompt from multiple sources and need both cleanup passes.
Order of the surviving tags matters to you and you're not sure what you'll get. The safe assumption for a dedupe operation like this is that it keeps the first occurrence and drops later repeats, preserving your original ordering otherwise - which matters given that tag order affects emphasis in this prompting style, so put your most important source first in whatever's feeding this node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| tags TEXT | STRING | — |