ComfyUI Extension: ComfyUI-Caption-Cleaner

Authored by cristian1980

Created

Updated

2 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

A custom node for ComfyUI designed to automatically clean and format natural language captions (generated by VLMs like Florence-2, CogVLM, or JoyTag) for LoRA training datasets.

Looking for a different extension?

Custom Nodes (0)

    README

    ComfyUI Clean Caption (LoRA)

    A custom node for ComfyUI designed to automatically clean and format natural language captions (generated by VLMs like Florence-2, CogVLM, or JoyTag) for LoRA training datasets.

    It strips away "AI assistant" fluff, removes subjective descriptions, and enforces a trigger word.

    ✨ Features

    • Prefix Removal: Automatically removes common starting phrases like "The image is a digital illustration of..." or "The image shows...".
    • Subjective Filtering: Removes sentences describing "vibes" rather than visual content (e.g., removes "The overall mood is whimsical" or "The atmosphere is serene").
    • Filler Cleanup: Scrubs specific filler phrases inside sentences (e.g., "in the image", "digital painting").
    • Trigger Word Enforcement: Automatically adds your specific LoRA trigger word to the start of the caption if it isn't already there.

    📦 Installation

    1. Navigate to your ComfyUI custom nodes directory:
    cd ComfyUI/custom_nodes/
    
    
    1. Clone this repository:
    git clone https://github.com/cristian1980/ComfyUI-Caption-Cleaner.git
    
    
    1. Restart ComfyUI.

    🚀 Usage

    Find the node under LoRA/Text > Clean Caption (LoRA).

    Parameters

    | Input | Type | Description | | --- | --- | --- | | text | STRING | The raw caption text (usually from a VLM node or text file). | | trigger_word | STRING | The token you want to train (e.g., sks, my_char). Default: cayesvgrt. | | enabled | BOOLEAN | Toggle the cleaning process on or off. |

    Example

    Input Text:

    "The image is a digital illustration of a futuristic cyborg standing in neon rain. The overall atmosphere is dark and moody. In the image, the cyborg is holding a glowing sword."

    Trigger Word: cyb0rg

    Output Text:

    "cyb0rg, A futuristic cyborg standing in neon rain. The cyborg is holding a glowing sword."

    🛠️ Logic Details

    The node performs the following operations in order:

    1. Prefix Stripping: Checks for and removes ~8 common VLM descriptive prefixes.
    2. Sentence Filtering: Splits text into sentences and discards any containing "bad keywords" (like "overall style", "cartoon-like", "design").
    3. Phrase Removal: Removes specific noise phrases ("vector art", "to the scene") from remaining sentences.
    4. Formatting: Cleans whitespace, fixes punctuation, and prepends the trigger_word.

    Run ComfyUI workflows without the setup

    No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

    Learn more