Nodes/Illustrious LoRA Tools/Illustrious Batch Auto-Tag (ONNX)
ComfyUI Node

Illustrious Batch Auto-Tag (ONNX)

WD14 tagging that won't clobber the captions you wrote yourself

By katorikonoe-ai·Created 17 days ago·Updated 3 days ago· 0
Illustrious Batch Auto-Tag (ONNX)
  • dataset
  • dataset
  • report
model
batch_size4
general_threshold0.35
character_threshold0.85
trigger
exclude_tags
overwrite_prepared_captionsfalse
allow_model_downloadfalse

If you're training on Illustrious, your captions should be Danbooru tags, because that's the interface the base model was trained against. Hand-writing 1girl, solo, looking at viewer, long hair for 60 images is the gold standard and also an afternoon you'll never get back. This node runs a WD tagger over a prepared dataset and writes comma-separated tags next to every image - with one design choice that tells you the author has actually done this before: existing captions are kept unless you explicitly ask for an overwrite.

What it does, mechanically

It loads a SmilingWolf WD tagger as an ONNX graph through onnxruntime on the CPU - no CUDA, no torch, two threads - and runs it over the images in your prepared run in batches. Each image is EXIF-rotated, composited onto white to kill alpha, padded to a square, resized to the model's input size, and converted to BGR with 0–255 values, which is what the WD ONNX exports expect. Then it maps the model's output scores against the bundled selected_tags.csv.

Only two tag categories are used: general and character. Rating tags are dropped, so nothing in your captions ends up declaring explicit or sensitive on its own. Underscores become spaces, so you get long hair, not long_hair - matching how the tags appear in prompts. Surviving tags are sorted by descending score, deduplicated, and your trigger is prepended. The finished line is written to the image's .txt.

The threshold logic is the part worth understanding: general_threshold (default 0.35) applies to general tags, character_threshold (default 0.85) applies to character names. Two thresholds, because the model's confidence distributions are different - character matches are usually confident when they're right, so a high bar filters out speculative character labels that would otherwise teach your LoRA the wrong identity.

Inputs that matter

dataset is the prepared run. model is a three-way choice: wd-swinv2-v3, wd-vit-v3, or wd-eva02-large-v3 - the SwinV2 one is the sane default, and the larger EVA02 model is slower for a modest accuracy bump. batch_size (default 4) is pure CPU throughput; it doesn't change the output text.

trigger is a single short line, max 200 characters, no newlines, prepended to every caption. Use a rare token - my_ch4r beats my character name, because a token that already means something to the model fights your LoRA every step of training.

exclude_tags is a comma-separated kill list, matched case-insensitively and with underscores normalised to spaces. Put watermark, signature, username and any site-specific junk in here.

overwrite_prepared_captions off means only images without a caption get tagged - that's how you tag a fresh import without destroying the three captions you hand-wrote. Turn it on and the node first copies the old file to <name>.txt.before_tagging before replacing it, which is the backup you'll be glad of exactly once.

allow_model_download off is the default, and it's the right default: the pack never phones home on its own. Turn it on and it fetches model.onnx and selected_tags.csv from the pinned SmilingWolf revision into ComfyUI/models/illustrious_taggers/<model>/<revision>/. Those weights are SmilingWolf's, not this pack's, so read their license if you care about that sort of thing.

Outputs are dataset (pass it on to the audit or the trainer) and report, JSON showing which model and revision ran, how many captions were written, and the thresholds used. Keep it - the report is your only record of what produced those captions.

Install

ComfyUI Manager, searching ComfyUI-IllustriousLoRATools (shown as Illustrious LoRA Tools), or:

cd ComfyUI/custom_nodes
git clone https://github.com/katorikonoe-ai/ComfyUI-IllustriousLoRATools
pip install -r ComfyUI-IllustriousLoRATools/requirements.txt

Two of those requirements are load-bearing here: onnxruntime and huggingface-hub. Install with ComfyUI's Python and don't let pip replace the CUDA PyTorch build. Keep native/, web/ and crop_routes.py next to __init__.py. Restart the server. The node lives under Katori/Illustrious Native Training.

Where people get burned

The first run with allow_model_download off fails with a missing-path error, because the tagger weights aren't on disk yet. That's not a bug, it's the opt-in. Enable the download once, then disable it again.

Lowering the character threshold to make your character appear is the second thing everyone does - and it's right, if the character is genuinely in the WD vocabulary. If it's an OC, no threshold will help; put the name in trigger instead.

Third: a WD tagger describes what it sees. On a character LoRA that means it will happily write purple hair, blue eyes onto every caption, which is exactly the information you want the LoRA to absorb rather than treat as a variable. Use the preview node's tag counts to find tags sitting on all 60 images, then strip them with the caption edit node. Auto-tagging gets you 80% of the way; that last 20% is where the LoRA actually gets good.

CategoryKatori/Illustrious Native Training

Inputs (9)

NameTypeDefaultDescription
datasetILLUSTRIOUS_DATASET
modelCOMBO3 options: wd-swinv2-v3, wd-vit-v3, wd-eva02-large-v3
batch_sizeINT41–32
general_thresholdFLOAT0.350–1
character_thresholdFLOAT0.850–1
triggerSTRING
exclude_tagsSTRING
overwrite_prepared_captionsBOOLEANfalse
allow_model_downloadBOOLEANfalse

Outputs (2)

NameTypeDescription
datasetILLUSTRIOUS_DATASET
reportSTRING