Nodes/ComfyUI-moondream/MoondreamQueryCaptions
ComfyUI Node

MoondreamQueryCaptions

Caption a Whole Batch Without Leaving ComfyUI — MoondreamQueryCaptions

By kijai·Created 3 years ago·Updated 2 years ago· 109
MoondreamQueryCaptions
  • images
  • text
questionWhat is this?
keep_model_loadedtrue
modelmoondream2
max_new_tokens256

MoondreamQueryCaptions is the batch variant of the pack's other node: same tiny vision-language model, same inputs, but instead of answering one question about one image, it runs every image through the pipeline and hands back a caption for each. It's the "I have a folder of images and want natural-language descriptions of all of them" node.

If you're prepping a LoRA training set, that's a real job. Captioning quality is one of the most impactful factors in training - and for natural-language (non-tag) captioning, the model itself is fine at it: moondream is a proper SigLIP + Phi-1.5 vision-language model, not a tagger. You wire a Load Images (or a folder loader) into images, keep the default question of "What is this?" - or write a more specific one - and you get back a short English description per image. It's genuinely useful for a handful of images without leaving the graph.

How it differs from MoondreamQuery

The sibling node answers one question and, when handed a batch, returns a JSON-ish dictionary string ({"0": "...", "1": "..."}) that you'd have to parse. This one always loops the whole batch and returns the answers as a list - one string per image, in order. That's the entire point of the name. Wire the text output into a list-aware node, a text-file writer, or anything that consumes one string per image.

Otherwise it's the same skeleton: images, question, model (moondream1/moondream2, default moondream2), keep_model_loaded, and max_new_tokens. The default 256-token cap is plenty for captions. keep_model_loaded defaults to true so a multi-batch run doesn't reload weights between every image - leave it on unless you're done and want the ~2GB freed from VRAM.

Installing it

ComfyUI Manager, search ComfyUI-moondream - that installs both nodes. Or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-moondream

Restart and the first run downloads the model from Hugging Face into checkpoints/moondream2/ - a couple of GB, silent, so don't assume it's hung. The pack's requirements.txt adds accelerate, huggingface-hub, Pillow, timm and einops but pins no transformers version, which is where the classic trap lives: moondream1 breaks on current transformers (a tensor-size-mismatch error, 760 vs 761). There's a one-line fix in kijai's repo issue #3, or you just stick with the default moondream2 and never see it.

The honest take

This pack has been untouched since March 2024, and as a captioner moondream was always more "fast enough" than "fast". People compared it against kijai's own Florence-2 node within months and reported Florence-2 as much faster per image - and by now, for serious training-data captioning, JoyCaption or Florence-2 are the community's picks. MoondreamQueryCaptions still wins for one thing: it's already in your ComfyUI install, it runs entirely locally on modest hardware, and it produces solid short natural-language captions for a few dozen images with zero setup beyond the model download. For a quick dataset pass without bolting on another toolchain, that's a perfectly reasonable trade.

CategoryMoondream

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
questionSTRINGWhat is this?
keep_model_loadedBOOLEANtrue
modelCOMBOmoondream22 options: moondream1, moondream2
max_new_tokensoptINT256

Outputs (1)

NameTypeDescription
textSTRING