Nodes/ComfyUI-DeZoomer-Nodes/Caption Refinement
ComfyUI Node

Caption Refinement

Give auto-generated captions a cleanup pass with a local Qwen

By De-Zoomer·Created about a year ago·Updated about a year ago· 29
Caption Refinement
    • refined_caption
    caption
    system_promptYou are an AI prompt engineer tasked with helping me modifying a list of automatically generated prompts. Keep the original text but only do the following modifications: - you responses should just be the prompt - Write continuously, don't use multiple paragraphs, make the text form one coherent whole - do not mention your task or the text itself - remove references to video such as "the video begins" or "the video features" etc., but keep those sentences meaningful - mention the clothing details of the characters - use only declarative sentences
    model_nameQwen/Qwen2.5-7B-Instruct
    temperature0.7
    max_tokens200
    quantization_type4-bit
    keep_model_loadedfalse
    seed1

    Auto-captioners get you 80% of the way, and then leave you with text that reads like a robot narrating a security tape. "The video begins with a woman walking…" - you'd never train on that. This node is the cleanup pass: it takes an existing caption and rewrites it as clean, continuous prose, stripping out video-narration phrasing, adding clothing details, and forcing everything into declarative sentences. It's the second half of the De-Zoomer dataset pipeline, and the reason your captions stop sounding machine-generated.

    That matters more than it sounds. In a video LoRA dataset, captions are doing real work - the model learns what to treat as variable (describe it) and what to leave fixed (don't). A caption full of "the video features" filler isn't just ugly, it's teaching the model nothing useful. Cleaning it up is one of the highest-leverage things you can do for training quality, short of captioning everything by hand.

    How it works

    This one has no vision at all - it's a plain Qwen2.5 text model (default Qwen/Qwen2.5-7B-Instruct), not the VL variant. You feed it a caption string, it rewrites it. The whole refinement policy lives in the default system_prompt, which is worth reading once because it's genuinely well-built: keep the original meaning, write continuously in one paragraph, delete video references, mention clothing, declarative sentences only. That prompt is the node's behavior, so editing it is how you steer the output toward your own style.

    The model loads through transformers with bitsandbytes quantization (4-bit nf4 by default, 8-bit as an option), fp16, device_map="auto". It auto-downloads to ComfyUI/models/LLM/ on first run, same as its sibling node. If you leave keep_model_loaded off it offloads to CPU after each call so the VRAM goes back to the rest of your graph.

    The inputs that matter

    • caption - the text to refine, required, wired as a STRING input. Straight from VideoCaptioning, or any caption source you like.
    • system_prompt - the default already encodes the refinement recipe. This is the author's own framing, and it's the thing you'll tweak first if you want different output.
    • model_name - 7B is the sane default. 1.5B is there for speed or tight VRAM; see the trap below before you reach for 72B.
    • max_tokens - caps the output at 200 by default. Long input captions can get truncated, so if your captions run long, raise it.
    • temperature - 0.7 default. Drop toward 0.3 if rewrites feel too loose.
    • quantization_type - 4-bit default. Only switch to 8-bit if quality genuinely suffers and you have the headroom.

    Output is a single refined_caption string. Wire it to a text-save node to write your cleaned dataset files.

    Installation

    Same pack, same drill as VideoCaptioning. ComfyUI Manager, search "DeZoomer", install. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/De-Zoomer/ComfyUI-DeZoomer-Nodes.git
    cd ComfyUI-DeZoomer-Nodes
    pip install -r requirements.txt
    

    Restart, and look under the DeZoomerNodes/text menu. Portable Windows: run pip through python_embeded\python.exe -m pip.

    Where people get burned

    The 72B option in the dropdown is a trap on consumer hardware - even 4-bit, a 72B model wants roughly 40GB of VRAM and most people don't have it. If ComfyUI grinds to a halt or the model load fails, that's why. Stick to 7B unless you know exactly what you're doing; the 1.5B is a legitimately fine fallback for short captions.

    The README's "16GB of GPU memory" is conservative for 4-bit - a 4-bit 7B runs in single-digit gigabytes. What it's really warning about is the first-run download, which pulls the full fp16 weights (~15GB) before quantizing at load, no matter which quantization you picked. Plan for that first run to take a while.

    Also worth knowing: the two nodes share the flash-attn dependency in requirements.txt, which is the usual Windows pain point. If the install dies on a C++ compile, fetch a prebuilt flash-attn wheel for your CUDA version before retrying - or, if you only care about this node, know that plain Qwen2.5 text runs fine without flash attention even though the pack insists on installing it. That's a quirk of the shared dependency list, not a failure on your end.

    CategoryDeZoomerNodes/text

    Inputs (8)

    NameTypeDefaultDescription
    captionSTRING
    system_promptSTRINGYou are an AI prompt engineer tasked with helping me modifying a list of automatically generated prompts. Keep the original text but only do the following modifications: - you responses should just be the prompt - Write continuously, don't use multiple paragraphs, make the text form one coherent whole - do not mention your task or the text itself - remove references to video such as "the video begins" or "the video features" etc., but keep those sentences meaningful - mention the clothing details of the characters - use only declarative sentences
    model_nameCOMBOQwen/Qwen2.5-7B-Instruct3 options: Qwen/Qwen2.5-7B-Instruct, Qwen/Qwen2.5-1.5B-Instruct, Qwen/Qwen2.5-72B-Instruct
    temperatureFLOAT0.70.1–1
    max_tokensINT20050–1000
    quantization_typeCOMBO4-bit2 options: 4-bit, 8-bit
    keep_model_loadedBOOLEANfalse
    seedINT11–18446744073709550000

    Outputs (1)

    NameTypeDescription
    refined_captionSTRING