Nodes/ComfyUI WD 1.4 Tagger/WD14 Tagger 🐍
ComfyUI Node Runs on cloud

WD14 Tagger 🐍

Auto-caption images into Danbooru tags

By pythongosssssΒ·Created 3 years agoΒ·Updated about a year agoΒ· 1,213
WD14 Tagger 🐍
  • image
  • STRING
β—„modelwd-v1-4-moat-tagger-v2β–Ί
β—„threshold0.35β–Ί
β—„character_threshold0.85β–Ί
β—„replace_underscorefalseβ–Ί
β—„trailing_commafalseβ–Ί
β—„exclude_tagsβ–Ί

You feed it an image, it hands you back a comma-separated list of Danbooru tags: 1girl, long hair, looking at viewer, outdoors, smile. That's the whole job, and it does it well enough to have been the default anime auto-tagger in ComfyUI for years. If you're building a dataset to train a LoRA on Illustrious, Pony, or NoobAI, this is the node you reach for to caption a folder of images without hand-typing tags for every one.

Why does that matter? Because Danbooru-trained models don't want sentences. They learned a structured vocabulary - 1girl, dutch angle, thighhighs - where a correct tag beats a paragraph of prose for controlling pose, clothing, and camera. Your training captions need to speak that same tag language, and WD14 Tagger produces exactly that format out of the box. It's the mirror image of how you'll prompt the finished LoRA. (For the natural-language crowd - Flux, Z-Image, Qwen-Image - you'd want a VL captioner like JoyCaption or Florence 2 instead; tags are the wrong tool there.)

How it works

Under the hood these are ONNX image-classification models trained by SmilingWolf on Danbooru data. You give it a picture, the model scores every tag it knows, and anything above your threshold makes the cut. It runs on CPU via onnxruntime and it's genuinely fast there - no GPU needed, which is a relief given yours is busy generating. Models download automatically the first time you pick one, so the first run is slow and needs internet; after that it's cached. It's also an output node, so it shows the tags right on the node - handy for eyeballing what it saw before wiring anything.

The inputs that actually matter

Only a few knobs are worth touching:

  • model - 11 to choose from. The default wd-v1-4-moat-tagger-v2 is a solid all-rounder and wd-v1-4-convnextv2-tagger-v2 is the long-time community favorite. The newer v3 line is in the list too - wd-eva02-large-tagger-v3 is the accuracy heavyweight, wd-swinv2-tagger-v3 and wd-vit-tagger-v3 are lighter. Any of them is fine; don't overthink it.
  • threshold (default 0.35) - the confidence cutoff for general tags. Lower it and you get more tags but more noise; raise it and you get only the confident ones. 0.35 is a reasonable middle. For clean training captions a lot of people nudge it up.
  • character_threshold (default 0.85) - a separate, higher bar for named-character tags, since a wrong character name in a caption is worse than a missing one.

The rest are quality-of-life. exclude_tags takes a comma-separated list you never want to appear (drop 1girl if it clutters every caption). replace_underscore turns long_hair into long hair - worth flipping on since most prompts use spaces. trailing_comma appends a comma, which some training-config parsers like.

The single output is STRING, and it's a list - batch a folder of images in and you get one tag string per image back out. You wire that STRING into a text-saving node to write .txt caption files next to your images.

Installing it

Two ways, both easy.

ComfyUI Manager: open the Manager, search for ComfyUI WD 1.4 Tagger, install, restart. Done.

Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/pythongosssss/ComfyUI-WD14-Tagger
cd ComfyUI-WD14-Tagger
pip install -r requirements.txt

On the Windows portable build use the embedded Python instead of bare pip: ../../../python_embeded/python.exe -s -m pip install -r requirements.txt. Restart ComfyUI and the node shows up under image β†’ WD14Tagger|pysssss. No pre-downloading models - they fetch on first use.

One shortcut worth knowing: right-click almost any node showing an image (a LoadImage, PreviewImage, SaveImage) and pick WD14 Tagger from the menu to interrogate it on the spot, no wiring required.

Common issues

The dependency to get right is onnxruntime, which ships in requirements.txt and runs on CPU. There's a GPU variant, onnxruntime-gpu, and the author is blunt: lots of people hit problems with it and it's explicitly unsupported. CPU inference is already fast for tagging, so leave the default - the GPU package isn't worth the CUDA-version headache.

First-run behavior trips people up too. Models download at runtime, so a fresh model choice means a network call; if you're offline it fails there rather than at the tags. You can pre-seed models by hand (grab model.onnx and selected_tags.csv, rename to match the model), but interrogating one image online to warm the cache is simpler.

The last thing isn't a bug, it's a missing piece: the node only produces tags, it doesn't save them. To build a captioned dataset you pair it with a batch loader and a text writer - the common combo is WAS Node Suite's Load Image Batch feeding the tagger and its Save Text File writing the STRING output to disk with matching filenames. That three-node chain is the real "auto-caption a folder" workflow.

Categoryimage

Inputs (7)

NameTypeDefaultDescription
imageIMAGEβ€”
modelCOMBOwd-v1-4-moat-tagger-v211 options: wd-eva02-large-tagger-v3, wd-vit-tagger-v3, wd-swinv2-tagger-v3, wd-convnext-tagger-v3, wd-v1-4-moat-tagger-v2, wd-v1-4-convnextv2-tagger-v2, +5
thresholdFLOAT0.350–1β€”
character_thresholdFLOAT0.850–1β€”
replace_underscoreBOOLEANfalseβ€”
trailing_commaBOOLEANfalseβ€”
exclude_tagsSTRINGβ€”

Outputs (1)

NameTypeDescription
STRINGSTRINGβ€”