ComfyUI Node

Batch Joy Caption Two

Point it at a folder, get a caption file per image

By EvilBT·Created 2 years ago·Updated about a year ago· 721
Batch Joy Caption Two
  • joy_two_pipeline
  • STRING
input_dir
output_dir
caption_type
caption_lengthlong
low_vramfalse

Same node as Joy_caption_two, except instead of one image socket you give it a directory. Point input_dir at a folder of training images, run the graph once, and it captions every image in it - no wiring up one node per image, no manually saving each string. This is the node for the moment you've collected your LoRA dataset and just need captions for all of it, fast, with the plain feature set.

Reach for this over the advanced batch node when you don't need extra_options, a custom prompt, or trigger-word prefixing - just consistent captions across a folder with one style and one length setting applied uniformly.

How it works

It loops the same SigLIP-then-Llama captioning pass from Joy_caption_two over every image in input_dir, using one loaded JoyTwoPipeline for the whole run - so you pay the model-load cost once instead of per image. Captions get written out as you go rather than held in memory until the end.

The inputs and outputs that matter

  • joy_two_pipeline - from Joy_caption_two_load, required as always.
  • input_dir - folder of images to caption.
  • output_dir - where caption files land. Leave it empty and captions save right next to the source images in input_dir instead - handy if you want the .txt files sitting alongside their images without a second folder to manage.
  • caption_type and caption_length - same nine styles and length options as the single-image node. Whatever you pick applies to the whole folder uniformly, so pick a style that makes sense for every image in the set, not just the first one.
  • low_vram - same tradeoff as elsewhere in the pack: slower, smaller footprint.

Output is a STRING, but for this node the real output is the caption files written to disk during the run - the string return is secondary. The files are what your training script will actually read.

How to install it

Through ComfyUI Manager: search "JoyCaptionAlpha Two for ComfyUI" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/EvilBT/ComfyUI_SLK_joy_caption_two.git
pip install -r ComfyUI_SLK_joy_caption_two/requirements.txt

Restart ComfyUI. This node has no model dependencies of its own - everything lives on Joy_caption_two_load upstream. SigLIP and your chosen Llama checkpoint auto-download; the JoyCaption adapter has to be manually copied from the fancyfeast/joy-caption-alpha-two HuggingFace space into models/Joy_caption_two, and that step won't happen for you.

Common issues & troubleshooting

It's slow on a large folder. That's expected - you're running an 8B-parameter model once per image, sequentially. There's no batching-within-batching here; budget real time for a few hundred images, more so on low_vram.

Ran out of VRAM partway through a large batch. Turn on low_vram, and if you loaded the full-precision Llama checkpoint on Joy_caption_two_load, switch to the 4-bit one - that's the configuration the pack was actually built and tested against, and it's the difference between fitting in 8GB and not.

Captions are consistent but not what you need for training - too tame, missing detail, wrong style for a mixed dataset. This node has no extra_options or custom_prompt socket. Move to Batch_joy_caption_two_advanced once you need that level of control, or when different images in your set need different handling (it adds prefix/suffix caption fields too, useful for injecting a trigger word across the whole folder after captioning).

Output directory ends up empty. Check output_dir isn't pointing somewhere that doesn't exist yet - create it first, or leave the field blank and let captions land next to the source images instead.

CategorySLK/LLM

Inputs (6)

NameTypeDefaultDescription
joy_two_pipelineJoyTwoPipeline
input_dirSTRING
output_dirSTRING
caption_typeCOMBO9 options: Descriptive, Descriptive (Informal), Training Prompt, MidJourney, Booru tag list, Booru-like tag list, +3
caption_lengthCOMBOlong31 options: any, very short, short, medium-length, long, very long, +25
low_vramBOOLEANfalse

Outputs (1)

NameTypeDescription
STRINGSTRING