ComfyUI Node

🐾Save_Prompts

The node that actually writes your training captions to disk

By pzc163·Created 2 years ago·Updated 2 years ago· 86
🐾Save_Prompts
    • captions
    filenames
    captions
    save_folderYour save directory
    filename_prefix
    modeoverwrite

    Captioning for a LoRA run isn't done until the captions are files on disk next to your images - the step everyone forgets to automate. Save_Prompts is the quiet companion node in the MiniCPM prompt-generator pack that does exactly that: take a filename and a caption, write them to a folder, done. No model, no GPU, no download. It's the bookkeeping half of the captioning workflow.

    It's designed to hang off the pack's main Prompt_Generator node. Wire Prompt_Generator's filenames output into Save_Prompts' filenames input, its captions output into captions, and point save_folder at where your dataset's caption files should live. Hit run and each caption becomes a .txt file. That's the whole "batch caption" flow in the README: Prompt_Generator in folder mode reads every png/jpg/jpeg in a directory, and Save_Prompts turns each generated caption into a same-named .txt file your trainer will pick up.

    The inputs

    • filenames (required) - this becomes the actual file name. In folder mode, Prompt_Generator hands you names like myimage.png → myimage.txt, so just pass it through.
    • captions (required) - the text to write.
    • save_folder (required) - the directory to write into; put your dataset's captions folder here.
    • filename_prefix - optional prefix prepended to the filename, useful if your trainer expects caption_<name>.txt.
    • mode - overwrite or append. Overwrite is the sane default; append is for when you're accumulating text across multiple nodes and don't want to clobber the file.

    It passes captions through as an output, and since it's an output node it runs last in the chain - so you can fork the same captions to a ShowText for a sanity check while the files get written.

    The small gotchas

    It writes exactly one file per execution; there's no loop inside. The sample workflow wires Prompt_Generator's list outputs straight across, which is fine for a single image, but if you're batching a whole folder you'll want to feed filenames/captions one item at a time (loop node or one run per image), because this node won't iterate for you.

    And watch mode: if you re-run a dataset pass in overwrite over a set you'd already hand-tuned, the new captions silently replace the old ones. You get no warning.

    That's all it does. It's the least glamorous node in the pack and the one that makes the folder-caption workflow actually finish. If you're only ever captioning one image at a time, skip it and just read the text off a ShowText; the moment you're doing 20+ images for a training run, this is what turns the output into a usable dataset.

    CategoryComfyui_MiniCPMv2_6-prompt-generator

    Inputs (5)

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

    Outputs (1)

    NameTypeDescription
    captionsSTRING