Nodes/ComfyUI_CaptionThis/Janus Pro Caption Images Under Directory ๐Ÿ‘
ComfyUI Node

Janus Pro Caption Images Under Directory ๐Ÿ‘

Batch-caption a folder for LoRA training

By MieMieeeeeยทCreated about a year agoยทUpdated 10 months agoยท 127
Janus Pro Caption Images Under Directory ๐Ÿ‘
  • model
  • log
โ—„directoryX://path/to/filesโ–บ
โ—„questionDescribe this image in detail.โ–บ
โ—„seed42โ–บ
โ—„temperature0.10โ–บ
โ—„top_p0.95โ–บ
โ—„max_new_tokens512โ–บ
โ—„keep_model_loadedtrueโ–บ
โ—„save_to_new_directoryfalseโ–บ
โ—„save_directoryโ€”โ–บ

This is the workhorse of the pack. Point it at a folder of images and it writes a caption for every one - saving each as a .txt file sitting right next to its image. That image.png + image.txt pairing is exactly the layout LoRA trainers (kohya, ai-toolkit, OneTrainer) expect, which tells you what this node is really for: preparing a training dataset without captioning a hundred images by hand.

Why this exists

Captioning is one of the highest-leverage steps in LoRA training, and doing it manually for a big set is soul-crushing. This node automates the boring part with Janus Pro's image-understanding model. For the LLM-encoder base models people train on today - Flux, Qwen-Image, Z-Image - the right caption style is natural language, and that's exactly what Janus produces. (If you're training an anime base in the Illustrious/Pony/NoobAI line, that world wants Danbooru-style comma tags from a WD14 tagger instead - Janus prose isn't the tool there.)

One rule from the training world worth burning in before you batch anything: describe what you want to stay adjustable, leave what should be permanent undescribed. For a character LoRA, caption the pose, expression and clothing (so the model treats them as variable) but don't caption the features that define the character. An auto-captioner describes everything it sees, so expect to skim the generated .txt files and prune - the machine gives you a strong first draft, not a finished dataset.

The inputs that matter

  • model - from Janus Pro Model Loader.
  • directory - the folder of images to caption. The default is a placeholder (X://path/to/files); replace it with a real path or nothing happens.
  • question (multiline, default "Describe this image in detail.") - the same steering wheel as the single-image node, applied to every file. Tailor it to your subject: for a style LoRA you might ask it to describe composition and palette; for a character you might ask it to focus on pose and outfit.
  • save_to_new_directory (off) and save_directory (optional) - by default captions are written alongside the source images. Flip save_to_new_directory on and set save_directory to send the .txt files somewhere else instead, handy if you want to keep your originals untouched.

temperature (0.1), top_p (0.95), max_new_tokens (512), seed and keep_model_loaded behave just like the single-image node - low temperature for faithful, consistent captions across the set.

The output is log (a STRING) - a run report of what got captioned, not the captions themselves. The captions land in the .txt files. You can wire log into a ShowText node if you want to watch progress.

How to install it

Part of ComfyUI-CaptionThis:

  • ComfyUI Manager (recommended): search CaptionThis, Install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-CaptionThis, then restart.

Janus weights pull from HuggingFace on first run (or set HF_ENDPOINT=https://hf-mirror.com for the mirror). Details on the Janus Pro Model Loader page.

Common issues & troubleshooting

It captions nothing / errors on the path. You left the X://path/to/files placeholder in, or the path is wrong. Give it a real directory of images.

Every caption over-describes the subject. That's the auto-captioner doing its job, and it's why you review the output. Prune the lines describing features you want the LoRA to bake in as fixed.

It's slow on a big folder. It's running a vision model per image - that's inherently not instant. Keep keep_model_loaded on so it isn't reloading between files, and use Janus-Pro-1B in the loader if 7B is too heavy for your card.

Category๐Ÿ‘ JanusProCaption

Inputs (10)

NameTypeDefaultDescription
modelMIE_JANUS_MODELโ€”
directorySTRINGX://path/to/filesโ€”
questionSTRINGDescribe this image in detail.โ€”
seedINT420โ€“18446744073709550000โ€”
temperatureFLOAT0.100โ€“1โ€”
top_pFLOAT0.950โ€“1โ€”
max_new_tokensINT5121โ€“2048โ€”
keep_model_loadedBOOLEANtrueโ€”
save_to_new_directoryBOOLEANfalseโ€”
save_directoryoptSTRINGโ€”

Outputs (1)

NameTypeDescription
logSTRINGโ€”