Nodes/comfy_Pond_Nodes/🐳 Qwen Image Captioner (Optimized)
ComfyUI Node

🐳 Qwen Image Captioner (Optimized)

Local VLM captioning with a real attention to VRAM — if you bring the model

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳 Qwen Image Captioner (Optimized)
  • image
  • caption
model_name
prompt_type
language
device
precisionbf16
max_length256
temperature0.7
auto_unloadtrue
attention_modeauto
custom_instructionDescribe this image in detail for use as a prompt in image generation.
max_image_size1024
num_beams1
use_cachetrue

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 bitsandbytes installed; 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.

Category🐳Pond/Qwen

Inputs (14)

NameTypeDefaultDescription
imageIMAGE
model_nameCOMBO1 options: No models found in models/Qwen/
prompt_typeCOMBO5 options: detailed, brief, technical, artistic, custom
languageCOMBO2 options: English, 中文
deviceCOMBO3 options: auto, cuda, cpu
precisionCOMBObf163 options: bf16, int8, int4
max_lengthINT25632–2048
temperatureFLOAT0.70.1–2
auto_unloadBOOLEANtrue
attention_modeCOMBOauto4 options: auto, flash_attention_2, sdpa, eager
custom_instructionoptSTRINGDescribe this image in detail for use as a prompt in image generation.
max_image_sizeoptINT1024512–2048
num_beamsoptINT11–5
use_cacheoptBOOLEANtrue

Outputs (1)

NameTypeDescription
captionSTRING