Nodes/ComfyUI-Prompt-MZ/MinusZone - Captioner(PaliGemma)
ComfyUI Node

MinusZone - Captioner(PaliGemma)

Overnight long-form captions for your whole dataset folder

By MinusZoneAI·Created 2 years ago·Updated about a year ago· 138
MinusZone - Captioner(PaliGemma)
    • debug
    model_name
    directory
    resolution512
    caption_suffix.caption
    force_updatefalse
    prompt_fixed_beginning

    Captioner(PaliGemma) is the batch version of the PaliGemma captioner: point it at a folder, and it writes a long natural-language caption file next to every image - image.png.caption by default - with a progress bar, retry logic, and skip-if-already-done behavior. If you're assembling a Flux-style training set and you want verbose captions instead of tag lists, this is the node you queue before you go to bed.

    The pitch, grounded in the KB's lora-training notes: for LLM-encoder models your caption is a chat turn, not a token bag, and models like PaliGemma tuned as SD3 long captioners produce exactly the multi-sentence descriptions those bases expect. The -v2 checkpoint is the one to reach for; it's the newer and better-regarded of the two.

    The inputs that matter

    • model_name - paligemma-sd3-long-captioner-v2 (default) or paligemma-sd3-long-captioner.
    • directory - the folder to walk (recursively) for .jpg, .jpeg, .png. The one that actually matters.
    • resolution - default 512, resize target before captioning.
    • caption_suffix - default .caption; switch to .txt for trainers that want that.
    • force_update - default False; skips images that already have captions. On → re-caption everything.
    • prompt_fixed_beginning - string prepended to every caption, handy for a trigger word.

    Output: a debug STRING. Like the Florence-2 captioner, the real product is the files on disk.

    How it works

    It's the pack's shared batch-captioning runner pointed at PaliGemma: walk the directory, skip already-captioned files unless forced, convert each image to a tensor, run the model (kept resident across the batch for speed), write the caption file, retry with a bumped seed up to 5 times if a generation comes back empty. The progress bar in the UI is the only live feedback - which is exactly what you want for a long batch.

    Installing

    Part of ComfyUI-Prompt-MZ:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MinusZoneAI/ComfyUI-Prompt-MZ
    

    Restart. Needs transformers + torch; the PaliGemma weights download to ComfyUI/models/minus_zone_models on first run (multi-GB).

    Troubleshooting

    The three realistic complaints: (1) Speed - PaliGemma long captions are token-hungry, so each image is slower than a Florence-2 pass. A big folder is an overnight job; don't start it mid-afternoon expecting to train by evening. (2) VRAM - the model stays resident for the whole batch, so close heavy sampler windows or run it as a standalone job; on smaller cards, expect a tight squeeze alongside a diffusion model in the same session. (3) Wrong caption style for your base - long prose captions are right for natural-language/LLM-encoder bases and wrong for Danbooru-tag bases. Also remember force_update: if you ran once with the old model and want v2 captions, you have to flip it on or the existing files get skipped. And as with any auto-captioner, spot-check the output - the KB's standing advice is that hand-captioning is still the gold standard for small sets, with auto-captioning as the 90% starter.

    CategoryMinusZone - Prompt

    Inputs (6)

    NameTypeDefaultDescription
    model_nameCOMBO2 options: paligemma-sd3-long-captioner-v2, paligemma-sd3-long-captioner
    directorySTRING
    resolutionINT512128–18446744073709550000
    caption_suffixSTRING.caption
    force_updateCOMBOfalse2 options: false, true
    prompt_fixed_beginningSTRING

    Outputs (1)

    NameTypeDescription
    debugSTRING