Nodes/ComfyUI-Miaoshouai-Tagger/🐾MiaoshouAI Save Tags
ComfyUI Node

🐾MiaoshouAI Save Tags

The node that actually writes your caption files to disk

By miaoshouai·Created 2 years ago·Updated about a year ago· 526
🐾MiaoshouAI Save Tags
    • captions
    filenames
    captions
    save_folderYour save directory
    filename_prefix
    modeoverwrite

    Every LoRA trainer - kohya, ai-toolkit, OneTrainer, all of them - expects a dataset laid out as matched pairs: image.png next to image.txt, where the .txt holds the caption. Getting captions in ComfyUI is the interesting part of this pack's workflow; getting them onto disk in that exact format is the unglamorous part nobody writes a tutorial about. That's this node's whole job. It's the terminal step: plug in what the Tagger (or Caption Analyzer) produced, and it writes the files.

    How it works

    This is an output node - it doesn't pass a modified image or conditioning further down a graph, it performs a side effect and hands you back a passthrough for convenience. Wire in filenames and captions from Miaoshouai Tagger (or a selected analyze string from Caption Analyzer if you filtered the caption first), point save_folder at your dataset directory, and running the workflow writes one text file per image, named to match.

    filename_prefix lets you stamp something onto the front of every saved filename - handy if you're captioning the same folder with different settings across a few runs and don't want them clobbering each other. mode is the one setting worth pausing on: overwrite replaces whatever caption file is already there, append adds to it. If you've hand-corrected a few caption files after an earlier auto-caption pass and then rerun this node in overwrite mode, those manual edits are gone - the node doesn't diff or ask, it just writes. If you're layering multiple caption passes (say, tags from one run plus a description from another) append is what keeps both, though be aware it'll also duplicate content if you accidentally run the same pass twice.

    The inputs and outputs that matter

    Required: filenames and captions (the pair to save - normally piped straight from the Tagger node's matching outputs), save_folder (a real, writable path - the default placeholder text is literally "Your save directory," which is the pack's way of telling you it won't guess one for you), filename_prefix (optional text prepended to each saved filename, blank by default), and mode (overwrite or append).

    One output: captions, a passthrough of what was just written. It's marked as the pack's only is_output_node: true node - the one that does the actual disk write rather than just shaping data for the next node in the chain.

    How to install it

    Same pack as the other three MiaoshouAI nodes. ComfyUI Manager: search "ComfyUI-Miaoshouai-Tagger", install, restart. Manually:

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

    transformers 4.38.0+ is required for the pack as a whole, though this specific node doesn't touch Florence-2 itself - it's pure file I/O once the caption exists.

    Common issues & troubleshooting

    Manual caption fixes disappear after a rerun. That's mode: overwrite doing exactly what it says. If you're iterating on a dataset by hand-editing a handful of files after auto-captioning, either keep those files outside the folder this node targets, or switch to append and clean up duplicates afterward - there's no merge option here, just replace or add.

    Nothing gets written, or it errors on the folder. save_folder needs to already exist and be writable - it's a plain path field with no default beyond a placeholder string, so if you never filled it in past the sample text, that's the first thing to check.

    Duplicate captions piling up in the same file. A symptom of append mode plus running the workflow more than once over the same images. Switch to overwrite for a clean single pass, or clear the target folder before a fresh append run if you genuinely want to accumulate multiple caption sources.

    CategoryMiaoshouAI Tagger

    Inputs (5)

    NameTypeDefaultDescription
    filenamesSTRING
    captionsSTRING
    save_folderSTRINGYour save directory
    filename_prefixSTRING
    modeCOMBOoverwrite2 options: overwrite, append

    Outputs (1)

    NameTypeDescription
    captionsSTRING