Nodes/D2 Nodes ComfyUI/D2 Tag Report
ComfyUI Node

D2 Tag Report

Find the tags your training captions overuse — before they wreck your LoRA

By da2el-ai·Created 2 years ago·Updated 5 days ago· 66
D2 Tag Report
  • get_tags
  • text
folder
include_subfoldersfalse
extensiontxt
order_bycount_9-0
without_countfalse
output_typeremove_comment
separatorLine break
text

Every LoRA trainer hits the same wall: your dataset's captions are full of tags you didn't intend to teach, and you'd like a quick census of which ones appear everywhere before you start excluding them. D2 Tag Report is a folder-scanner that counts tag frequency across your caption files and outputs a sorted report - including a ready-made exclude list you can paste back into caption processing. It's a training-data hygiene tool, and it's genuinely useful for anyone working with Danbooru-style tag captions.

How it works

Point it at a folder of caption files (.txt by default, include_subfolders to recurse), and it aggregates every tag across those files, counting how often each appears. The get_tags button triggers the scan from the UI; the report flows through the text output. The order_by dropdown sorts the result by count (high→low, or low→high) or alphabetically, and without_count strips the numbers if you want a clean list rather than a report.

The interesting part is how it hooks into caption cleanup. text accepts an existing caption or tag list, and output_type - remove_comment or output_comment - controls whether commented-out tags are dropped or kept. separator picks Line break or Comma + Space for the output. So the workflow the docs describe: run the report to find your overused tags, build an exclude list, and feed it back through your caption-processing chain (the pack's D2 Save Caption is the natural partner) to strip them from every caption before training.

Inputs

  • folder - where your captions live. The one thing you must set.
  • include_subfolders / extension - recursion and file type (default txt).
  • order_by - sort order for the report.
  • without_count - strip the count numbers from the output.
  • output_type - whether commented tags survive into the output.
  • separator - line break or comma+space for the output list.
  • text - optional input text to process; if you're just scanning a folder you can leave it empty and use get_tags.
  • get_tags - the button that runs the scan.

One output: text, the report or cleaned list.

Why you'd bother

Captions are the loudest signal in a LoRA. If 1girl shows up in 400 of your 420 captions, your model is learning it whether you meant to or not - and if it's not a tag you want baked in, that's exactly the kind of thing that shows up as a hard-coded look later. D2 Tag Report surfaces those biases in one scan, and its companion nodes let you act on it in the same graph. If you only ever train with hand-written one-line captions, this is less relevant; the moment you're cleaning a few hundred scraped captions, it pays for itself.

Installing and troubleshooting

Part of D2 Nodes ComfyUI:

cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI

or search "D2 Nodes ComfyUI" in ComfyUI Manager. No models, no extra deps.

Practical notes: the folder path is a local filesystem path - give it an absolute path to your caption folder and it just works. If get_tags returns an empty report, check the extension and the subfolder toggle; captions in a different directory tree than you think is the classic miss. And a tip: run it with without_count off first to see the full picture, then turn it on when you want the bare list to feed into exclusion logic. The report is a diagnostic, and the bare list is the tool.

CategoryD2/Text

Inputs (9)

NameTypeDefaultDescription
folderSTRING
include_subfoldersBOOLEANfalse
extensionSTRINGtxt
order_byCOMBOcount_9-04 options: count_9-0, count_0-9, tag_a-z, tag_z-a
without_countBOOLEANfalse
output_typeCOMBOremove_comment2 options: remove_comment, output_comment
separatorCOMBOLine break2 options: Line break, Comma + Space
textSTRING
get_tagsoptD2_BUTTON

Outputs (1)

NameTypeDescription
textSTRING