Nodes/ComfyUI Llava-OneVision/OneVision Caption Folder
ComfyUI Node

OneVision Caption Folder

Batch-caption a whole folder for LoRA training in one queue

By kijai·Created 2 years ago·Updated 8 months ago· 101
OneVision Caption Folder
  • llava_model
  • STRING
folder_path
promptYou are AI captioning tool, you caption images in very elaborate detail without referring to the image as 'the image', the results should be useful for image model training purposes. You focus on the composition, style and action any possible subject is performing. You don't make assumptions or try to tell a story. You also describe the background of the image separately. Caption this image:
max_tokens512
keep_model_loadedtrue
temperature0.20
seed1
max_image_size1024
prefix
suffix

This is the reason most people install the pack. OneVision Caption Folder points at a folder of images, captions every one of them, and writes a matching .txt file next to each image. That's the whole job, and it's exactly the dataset-prep chore that makes or breaks a LoRA.

Here's why that matters. Captioning is the single highest-leverage part of training an LLM-encoder model like Flux, Qwen-Image, or Z-Image - these models learn from natural language captions, and what you write (or don't write) is what becomes trainable or gets baked in as a fixed feature. The community's favorite dedicated tool is JoyCaption, and Florence-2 has its fans, but a lot of people want something that runs fully local inside ComfyUI with no extra Ollama install. That's the gap this node fills. It's not the fanciest captioner in the world, but it's self-contained, and the default prompt it ships with is genuinely well-tuned for training captions: it tells the model to describe composition, style, and action, to keep background separate, and not to invent a story. Keep it.

How it works. The node scans the folder for .png, .jpg, and .jpeg files, resizes any image whose longest side exceeds max_image_size down to that size (LANCZOS - it only ever downscales, never upscales), then runs the same inference core as LLaVA-OneVision Run on each image in turn. A progress bar keeps you sane during long folders. For every image it writes <filename>.txt right beside it and collects the caption into an output list. It's a slow, deliberate loop, not a parallel pipeline - plan for it.

The inputs that matter:

  • llava_model - from the (Down)Load LLaVA-OneVision Model node, as always.
  • folder_path - an absolute path to your image folder. The one input everyone forgets to double-check.
  • prompt - the big training-oriented default. Edit it, don't fear it.
  • max_tokens - default 512 here (the Run node defaults to 4096). Fine for captions; raise it if your prompt asks for elaboration.
  • temperature - default 0.2. Low-ish so captions stay factual; the model is making a claim about a real image, so you don't want it improvising.
  • seed - lets you reproduce a run, though it's hashed, so treat it as "same seed ≈ same output" rather than literal.
  • max_image_size - default 1024. Downscaling speeds up the 7B dramatically; for training captions you rarely need the model to see full-res details.
  • prefix / suffix - strings prepended/appended to every caption. This is your trigger-word slot. Put ch9ractername in prefix and every caption starts with it - the cleanest way to wire a trigger into a dataset.

The output is a STRING list of all captions in folder order. The files are usually the real deliverable, but the list is handy if you want to dump it somewhere else in the graph.

Gotchas. Only .png, .jpg, .jpeg are processed - .webp and .bmp are silently skipped, so check your folder before you queue a big run. Writing the .txt in-place means it overwrites any existing file with the same name; run it on a copy if you're nervous. And speed: a 7B model on a folder of a few hundred images is a "go make tea" operation. If you're captioning a real dataset, load the 0.5B variant - the quality gap is small for captioning and the time difference is enormous. Also worth knowing: this node is the only file-writer in the whole pack. The node literally named SaveCaptionToTextFile doesn't write files; this one does.

Install is the pack-wide story: ComfyUI Manager → search "ComfyUI Llava-OneVision", or git clone https://github.com/kijai/ComfyUI-LLaVA-OneVision into custom_nodes and restart. Keep keep_model_loaded on true here - reloading a 7B between every image would make an already slow job interminable.

CategoryLLaVA-OneVision

Inputs (10)

NameTypeDefaultDescription
llava_modelLLAVAMODEL
folder_pathSTRING
promptSTRINGYou are AI captioning tool, you caption images in very elaborate detail without referring to the image as 'the image', the results should be useful for image model training purposes. You focus on the composition, style and action any possible subject is performing. You don't make assumptions or try to tell a story. You also describe the background of the image separately. Caption this image:
max_tokensINT5121–8192
keep_model_loadedBOOLEANtrue
temperatureFLOAT0.200–1
seedINT11–18446744073709550000
max_image_sizeINT1024256–8192
prefixSTRING
suffixSTRING

Outputs (1)

NameTypeDescription
STRINGSTRING