ComfyUI Node

Qwen2 VQA

The local node that turns your images into words (and words into prompts)

By IuvenisSapiens·Created 2 years ago·Updated 10 months ago· 580
Qwen2 VQA
  • source_path
  • STRING
text
modelQwen2-VL-2B-Instruct
quantizationnone
keep_model_loadedfalse
temperature0.7
max_new_tokens2048
min_pixels200704
max_pixels1003520
seed-1

You've got a folder of images you need natural-language captions for, or a reference image you want to describe before you fold it into a workflow, and you're tired of hand-typing. Qwen2 VQA is the node for that: it drops a real vision-language model - Alibaba's Qwen2-VL Instruct, in 2B or 7B - straight into your ComfyUI graph and lets you ask questions about anything you can feed it. The name says "VQA," but what people actually use it for is captioning: point it at an image, ask "describe this in detail," and get back a fluent sentence caption on a STRING output, ready to wire anywhere.

It's the kind of tool that sits upstream of everything else. Those natural-language captions feed LoRA training data (the KB's training guidance is blunt that sentence captions beat tags for Flux-style models), they make batch-dataset prep way less painful, and because the model is chatty, you can also use it as a prompt transformer - dump a rough idea in, get a polished description back. In the wider ecosystem this is the local answer to "image-to-text inside ComfyUI," and unlike some flashier VLM nodes, it calls no API and needs no key. Given the history of sketchy "LLM vision" custom nodes in the wild, that's worth saying: everything here runs locally, and the model weights come from the official qwen org on Hugging Face.

How it works

On first run the node downloads the model you picked into ComfyUI/models/prompt_generator/ automatically, so there's no separate download step - just patience, because a 7B checkpoint is multi-GB. It builds a chat message from your text query (plus any image/video content), runs it through Qwen's chat template, feeds the vision input through qwen-vl-utils (the same code Alibaba ships for Qwen2-VL), and generates tokens until it's done. The caption comes back on a single STRING output. There's no conversation memory: each run is a fresh, stateless question-and-answer, which is fine for captioning and mildly annoying if you were hoping for a real chat.

The inputs that matter

Most of the defaults are fine to leave alone. The three you'll actually touch:

  • text - your query or caption instruction. This is the whole job: "Describe this image in detail," "What's wrong with this render?", "Turn this into a detailed prompt for a diffusion model."
  • model - pick your size. Qwen2-VL-2B-Instruct is the light default and runs on modest GPUs; Qwen2-VL-7B-Instruct captions noticeably better but wants serious VRAM (~16 GB of weights in bf16 - the GPTQ-Int4/Int8 variants exist for a reason). Match the quantization setting to the GPTQ models, or leave it none.
  • keep_model_loaded - false by default, which unloads the model after every run to free VRAM. If you're captioning a whole batch, flip it on: reloading a multi-GB model between every image is the slowest thing this node does.

Also worth knowing: min_pixels/max_pixels control how the image is chopped into tokens for the model. Lower them for speed, raise them for text-heavy or detail-dense images where you don't want the model squinting. temperature (0.7 default) and max_new_tokens (2048) behave like any LLM - drop temperature for more consistent captions. The optional source_path input is how you feed images and video in: it takes the output of this pack's own loader nodes (ImageLoader, VideoLoader, MultiplePathsInput), which is why the README's example workflows all wire those together.

Installing it

ComfyUI Manager: search for Qwen3 (the pack rebranded to Qwen3-VL, which is why the Manager listing and the older node name don't match). Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/IuvenisSapiens/ComfyUI_Qwen2-VL-Instruct
cd ComfyUI_Qwen2-VL-Instruct
pip install -r requirements.txt

Then restart ComfyUI. The dependency list is the heavy part: transformers>=4.57.1, qwen-vl-utils, bitsandbytes, opencv-python, av, plus triton on Windows - expect a chunky install. If a node shows up as red/missing, this is the usual cause.

Gotchas

  • The README's example workflows assume a Display Text node, which isn't bundled with ComfyUI. If it's missing, grab it from the author's ComfyUI_MiniCPM-V-4_5 repo.
  • First run of a model is a big silent download - nothing appears to happen until it finishes. Give it time, and know where it's going (models/prompt_generator/).
  • The whole pack has moved on to Qwen3-VL (newer Qwen3_VQA class, FP8 variants, more models), but the Qwen2_VQA node still loads the Qwen2-VL line and works fine. If you want the newest models, note you may need the current repo checkout.
  • Windows + bitsandbytes occasionally refuses to cooperate; the GPTQ-Int4 paths are the fallback, and worst case run the 2B on plain fp16.
CategoryComfyui_Qwen2-VL-Instruct

Inputs (10)

NameTypeDefaultDescription
textSTRING
modelCOMBOQwen2-VL-2B-Instruct6 options: Qwen2-VL-2B-Instruct-GPTQ-Int4, Qwen2-VL-2B-Instruct-GPTQ-Int8, Qwen2-VL-2B-Instruct, Qwen2-VL-7B-Instruct-GPTQ-Int4, Qwen2-VL-7B-Instruct-GPTQ-Int8, Qwen2-VL-7B-Instruct
quantizationCOMBOnone3 options: none, 4bit, 8bit
keep_model_loadedBOOLEANfalse
temperatureFLOAT0.70–1
max_new_tokensINT2048128–2048
min_pixelsINT2007043136–12845056
max_pixelsINT10035203136–12845056
seedINT-1
source_pathoptPATH

Outputs (1)

NameTypeDescription
STRINGSTRING