🐳 Qwen Image Captioner (Optimized)
Local VLM captioning with a real attention to VRAM — if you bring the model
- image
- caption
The cleanest way to caption a stack of images for LoRA training, or to seed an img2img prompt from an existing image, is a vision-language model that reads the picture and writes the caption. That's the job QwenImageCaptioner does - and it does it fully local, on your own GPU, with a serious set of knobs for fitting it into your VRAM budget. It's from the 🐳 Pond Nodes pack (comfy_Pond_Nodes), and despite being buried in a kitchen-sink repo, the captioner is one of the more thoughtful nodes in it.
The headline: it doesn't call any API, needs no key, and won't send your images anywhere. The catch is right in the dropdown - until you put a model in the right folder, the model picker just reads "No models found in models/Qwen/".
How it works
It's a wrapper around HuggingFace transformers, specifically the Qwen2-VL / Qwen2.5-VL vision-language families. The node scans ComfyUI/models/Qwen/ for model folders you've dropped there, loads one with the precision you choose, runs it over your image, and returns the caption. The "optimized" part is real: an LRU cache keeps recently used models loaded instead of reloading every run, auto_unload frees the VRAM when you're done, and there's a FlashAttention2 path if you have flash-attn installed (it falls back to SDPA/eager gracefully).
The inputs that matter
- model_name - populated from whatever you placed in
ComfyUI/models/Qwen/. No models, no dropdown. - prompt_type - detailed, brief, technical, artistic, or custom. Sets the captioning style; custom uses your custom_instruction.
- precision - bf16, int8, or int4. This is your VRAM lever. int8/int4 need
bitsandbytesinstalled; on a 24GB card bf16 for a 7–8B model is comfortable. - device - auto, cuda, or cpu. CPU works but a 7B VLM on CPU is a slow-motion video.
- max_length, temperature, num_beams - generation controls. Keep beams at 1 unless you're patient.
- auto_unload - on by default, meaning the model leaves VRAM after each run. Turn it off if you're captioning in a loop and want it to stay hot.
- attention_mode - auto, flash_attention_2, sdpa, eager.
One output: caption (STRING), ready to feed a text node or a caption-file saver for training.
Installing it - the real story
The pack's requirements.txt does not include what this node needs. transformers isn't in it, nor bitsandbytes or accelerate. The source imports them and prints a friendly check on startup, but you have to install them yourself:
cd ComfyUI/custom_nodes
git clone https://github.com/Pondowner857/comfy_Pond_Nodes
pip install transformers accelerate bitsandbytes
(Add flash-attn only if you're comfortable building it - it's the single most painful pip install in the ecosystem.) Then drop a Qwen2-VL or Qwen2.5-VL model folder into ComfyUI/models/Qwen/ and restart. Model files are your responsibility - nothing downloads automatically.
The gotcha
This is a node that runs arbitrary local model code, in the category of "captioner" - the exact shape of the tool that was once weaponized as malware in this ecosystem (the ComfyUI_LLMVISION incident). It's almost certainly fine - the source is a straightforward transformers wrapper - but the community rule stands: skim the code of any local-VLM captioner before you run it. Also set expectations: 0.7 temperature gives you ordinary captions, not creative ones, and caption quality (describe the variable, leave the fixed) matters more for training than which VLM you pick.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_name | COMBO | 1 options: No models found in models/Qwen/ | |
| prompt_type | COMBO | 5 options: detailed, brief, technical, artistic, custom | |
| language | COMBO | 2 options: English, 中文 | |
| device | COMBO | 3 options: auto, cuda, cpu | |
| precision | COMBO | bf16 | 3 options: bf16, int8, int4 |
| max_length | INT | 25632–2048 | — |
| temperature | FLOAT | 0.70.1–2 | — |
| auto_unload | BOOLEAN | true | — |
| attention_mode | COMBO | auto | 4 options: auto, flash_attention_2, sdpa, eager |
| custom_instructionopt | STRING | Describe this image in detail for use as a prompt in image generation. | — |
| max_image_sizeopt | INT | 1024512–2048 | — |
| num_beamsopt | INT | 11–5 | — |
| use_cacheopt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| caption | STRING | — |