Nodes/WWAA-CustomNodes/🪠️ WWAA Prompt Writer
ComfyUI Node

🪠️ WWAA Prompt Writer

Turn an LLM's caption into the .txt file your LoRA trainer wants

By hgabha·Created 2 years ago·Updated 5 months ago· 37
🪠️ WWAA Prompt Writer
    • log_output
    text
    image_filename
    output_path
    overwritefalse
    prefix_text
    subdirectory

    If you've trained a LoRA, you know the annoying part isn't the training - it's generating a caption .txt for every single image in your dataset. WWAA Prompt Writer automates that step. Feed it a caption plus the image's filename, and it writes a same-named .txt file next to your image, ready for whatever trainer you use. The pack README frames it as the companion to the Image Batch Loader: load each image, run it through Florence2 (or another captioner), and let this node save the result as imagename.txt.

    It comes from the WWAA-CustomNodes pack by WeirdWonderfulAI.Art, and the design shows it was made by someone who actually trains: it lets you prepend a trigger word to every caption, and it organizes captions into subdirectories so you can run two different LLMs and keep their output separate.

    How it works

    The node takes text (the caption, multiline), image_filename (the source image's name), and output_path. It strips the extension from the image filename and writes basename.txt into the output path. Two behaviors matter:

    • overwrite defaults to False, and the code writes with exclusive-create mode - if the file already exists, it refuses to touch it and logs "skipping to prevent overwriting." Flip overwrite to True and it clobbers the old caption. That's a safety feature, and it will quietly skip files you thought it was updating. Check the log_output string if captions seem stale.
    • prefix_text gets glued to the front of the caption - the standard spot for your trigger word. This is worth using; captioning guidelines are consistent that a consistent trigger token plus clean captions is what makes a concept actually stick.

    output_path defaults to ComfyUI's output directory when empty, and you can add a subdirectory for organization. The single output is log_output, a detailed string of what it did - filename generated, path, whether it wrote or skipped. It's an output node, so it also surfaces that log in the UI.

    Inputs that matter

    • text + image_filename - the caption and its source name.
    • overwrite - leave False until you deliberately want to replace existing captions.
    • prefix_text - your trigger word, prepended to every caption.
    • subdirectory - optional folder under output_path.

    Installing it

    It's part of WWAA-CustomNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hgabha/WWAA-CustomNodes
    

    Restart ComfyUI. Or ComfyUI Manager → search "WWAA Custom Nodes" → Install → restart. You'll find it under 🪠️ WWAA/String. No models to download; the pack declares no extra Python dependencies.

    Gotchas

    The overwrite default is the one that'll bite you. If you improve your captions and re-run the workflow expecting fresh .txt files, nothing changes - the node skips existing files by design. Toggle overwrite on. Also, this node writes one file per image name, which is what a training folder wants; if you instead need every prompt appended into a single shared file (say, for testing a bunch of prompts against Flux), that's what its sibling WWAA LLM Prompt To Text File is for. Use the right writer for the job and the captioning pipeline mostly runs itself.

    Category🪠️ WWAA/String

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    image_filenameSTRING
    output_pathSTRING
    overwriteBOOLEANfalse
    prefix_textoptSTRING
    subdirectoryoptSTRING

    Outputs (1)

    NameTypeDescription
    log_outputSTRING