Nodes/WWAA-CustomNodes/🪠️ WWAA LLM Prompt To Text File
ComfyUI Node

🪠️ WWAA LLM Prompt To Text File

Batch LLM captions into one text file, ready for Flux testing

By hgabha·Created 2 years ago·Updated 5 months ago· 37
🪠️ WWAA LLM Prompt To Text File
    • log_output
    text
    output_path
    filenameoutput.txt
    prefix_text

    The WWAA LLM Prompt To Text File node (class WWAA_ImageToTextFile) exists for one specific, useful job: collecting captions generated for many images and appending them all into a single text file, one per line. The author's stated reason for building it: they needed a big batch of prompts to feed into Flux to test LoRA performance. Load images with the WWAA Image Batch Loader, caption each one with an LLM/vision model, and this node writes every prompt to the same file - which you then hand to a model or a tester.

    It's part of WWAA-CustomNodes from WeirdWonderfulAI.Art, and it's the sibling of Prompt Writer with a different philosophy: Prompt Writer creates one .txt per image (for training folders); this one creates one shared file (for batched prompt testing). Pick based on what you're feeding downstream.

    How it works

    You give it text (multiline) and an output_path; optionally filename (default output.txt) and prefix_text. It cleans the text before writing: converts line breaks to spaces, strips special characters (keeping letters, numbers, spaces, commas, periods, quotes, hyphens, semi-colons), collapses runs of whitespace to single spaces, and trims. Then it appends the cleaned line to the file - creating it if needed, or adding a newline before the entry if the file already exists. Prefix text, if given, gets prepended to each entry.

    That cleaning is a feature, not a bug: LLM captions come out with stray newlines and markup, and this normalizes them so each line in the output file is one clean prompt. The output is a log_output string - a detailed account of the parameters, cleaning, and file operation, which you'll want to glance at the first few runs to confirm entries are landing where you expect.

    Inputs that matter

    • text - the caption/prompt for the current image.
    • output_path - where the file lives (defaults to ComfyUI's output dir when empty).
    • filename - the shared target file.
    • prefix_text - prepended to each entry (handy for a common style tag).

    Installing it

    It's in the pack:

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

    Restart ComfyUI. Or ComfyUI Manager → search "WWAA Custom Nodes" → install → restart. It's under 🪠️ WWAA/String. No models to download.

    Gotchas

    Because it always appends, the file grows across runs - if you re-run the whole batch for a fresh test, old entries stay unless you delete the file (the node won't truncate it for you; that's what Prompt Writer's overwrite is for, and it doesn't apply here). And the character filter is strict: if you rely on colons, exclamation marks, or unicode in your prompts, they'll be stripped. That's fine for Flux-style tag prompts but surprising if you're feeding creative prose. Used for its intended batch-LoRA-testing loop, it turns a folder of images into a ready prompt file with essentially zero ceremony.

    Category🪠️ WWAA/String

    Inputs (4)

    NameTypeDefaultDescription
    textSTRING
    output_pathSTRING
    filenameoptSTRINGoutput.txt
    prefix_textoptSTRING

    Outputs (1)

    NameTypeDescription
    log_outputSTRING