moondream2 Query
Ask your renders questions — moondream2 Query is a local second pair of eyes
- model
- md2_image
- answer
moondream2 Query is the node that lets you talk back to an image: you type a question, it answers about what it sees, and none of it leaves your machine. Think of it as a tiny, always-available vision model you can stick anywhere in the graph to check your own output.
The killer use is quality control. "Are her eyes closed?" "How many fingers?" "Is there a watermark?" "What does that sign actually say?" Running a batch through a yes/no check before you spend an upscale pass on a broken frame is exactly the kind of thing that pays for this node in one session. It's also handy for auditing a dataset - ask ten images the same question and read the answers, rather than eyeballing each one.
How it works
Like its sibling Caption node, Query takes the pre-encoded result from moondream2 Encode - not a raw image - plus the loaded model, and runs the small language half of moondream2 with your question as the prompt. The generation is capped by max_tokens. Because encoding is the expensive part and it's already been done once, you can fire several questions at the same image nearly free after the first one.
Inputs and output
- model - the moondream2 from the DownLoad node.
- md2_image - the output of moondream2 Encode. You have to encode first; there's no shortcut.
- question - free text, default "What is this?". This is the whole point of the node, so type something useful.
- max_tokens - answer length cap, 512 by default. Fine for short answers, which is what you'll usually want.
The answer comes out as a STRING. Feed it to a text-display node or save it to disk; a common pattern is a small QC loop that saves the answer to a log alongside the image.
Install
Via ComfyUI Manager (search ComfyUI-moondream2) or:
cd ComfyUI/custom_nodes
git clone https://github.com/zhilemann/ComfyUI-moondream2
Then restart ComfyUI. First run downloads the weights from HuggingFace - a couple of gigabytes for the 2b model, so don't panic when it looks stuck.
Common issues
Set expectations before anything else: this is a ~2B model, so it's excellent at concrete yes/no checks and short factual questions, and confidently wrong on vague open-ended ones. "Does the image have text on it?" - reliable. "Describe the emotional subtext" - it will guess, with full confidence and half the facts missing.
The other two gotchas are shared with the whole pack: a transformers load error means your transformers is too old (pip install -U transformers, restart), and if you wired an image straight into Query you'll get a type mismatch - run it through Encode first. And remember that once a model version is fixed in this pack, it stays fixed; moondream2 itself is a generation old upstream, so don't hold your breath for a quality bump from updates here.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | moondream2 | — | |
| md2_image | MD2_IMAGE | — | |
| question | STRING | What is this? | — |
| max_tokens | INT | 512 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| answer | STRING | — |