Nodes/JoyCaptionAlpha Two for ComfyUI/Batch Joy Caption Two Advanced
ComfyUI Node

Batch Joy Caption Two Advanced

Caption an entire LoRA dataset folder with trigger words baked in

By EvilBT·Created 2 years ago·Updated about a year ago· 721
Batch Joy Caption Two Advanced
  • joy_two_pipeline
  • extra_options
  • STRING
input_dir
output_dir
renamefalse
prefix_name
start_index1
caption_type
caption_lengthlong
name
custom_prompt
low_vramfalse
top_p0.90
temperature0.60
prefix_caption
suffix_caption

This is the full toolkit: everything Joy_caption_two_advanced can do (extra options, custom prompt, sampling controls), everything Batch_joy_caption_two can do (folder in, caption files out), plus a set of batch-only extras - renaming files as it goes, and gluing a prefix or suffix onto every single caption it writes. That last part is the one worth knowing about even if you skip everything else on this node: it's how you inject a trigger word across an entire dataset in one pass instead of scripting it separately after captioning.

That matters because trigger words are still standard LoRA practice - a rare token like ohwx or ch9ractername that won't collide with real vocabulary, prepended or appended to every caption so the model has something unambiguous to key off of. Normally that's a separate step after captioning. Here it's built in.

How it works

Same SigLIP-plus-Llama captioning loop as the rest of the pack, run once per image in input_dir, with the prompt built from caption_type, caption_length, extra_options, and optionally overridden entirely by custom_prompt - identical mechanics to Joy_caption_two_advanced. The batch-specific fields (rename, prefix_caption, suffix_caption) are applied as a post-processing pass on top of whatever the LLM generates, before it gets written to output_dir.

The inputs and outputs that matter

Inherited from the advanced single-image node: joy_two_pipeline, caption_type, caption_length, extra_options, name, custom_prompt, low_vram, top_p, temperature - same behavior, see the Joy_caption_two_advanced writeup if you need the details on any of those.

What's new here:

  • input_dir / output_dir - same as the plain batch node; leave output_dir blank to save alongside the source images.
  • rename - when on, output files get renamed sequentially instead of keeping their original filenames.
  • prefix_name and start_index (default 1) - the naming scheme when rename is on, e.g. prefix_name + an incrementing number starting from start_index.
  • prefix_caption and suffix_caption - plain strings glued onto the front or back of every generated caption. This is the trigger-word field: put your unique token here and every caption in the folder gets it, consistently, without touching the LLM's output by hand.

Output is a STRING, but as with the plain batch node, the files written to output_dir during the run are the actual deliverable.

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. No dependencies of its own beyond the pack's shared requirements - the model weights all live on Joy_caption_two_load upstream. SigLIP and your chosen Llama checkpoint auto-download; the JoyCaption adapter needs a manual pull from the fancyfeast/joy-caption-alpha-two HuggingFace space into models/Joy_caption_two - miss that step and the whole chain fails before it gets to this node.

Common issues & troubleshooting

prefix_caption/suffix_caption show up but look mashed onto the caption with no spacing. Add your own leading or trailing space/comma inside the field - the node doesn't insert punctuation or spacing for you.

Renamed files aren't in the order you expected. rename with start_index numbers files in whatever order the batch processes them (typically directory listing order), not necessarily the order you'd sort them visually - check the actual filenames if ordering matters for your pipeline.

A large batch runs out of VRAM partway through, or is very slow. Same story as the rest of the pack: turn on low_vram, and make sure Joy_caption_two_load upstream is set to the 4-bit Llama checkpoint rather than full precision - that's the configuration the pack author actually ran this on (8GB VRAM), and it's the difference between a batch completing and it not.

Only using this for the trigger-word fields and not touching extra_options or custom_prompt at all. That's a completely reasonable way to use this node - leave extra_options unwired and custom_prompt empty, set caption_type/caption_length like you would on the plain batch node, and just use prefix_caption/suffix_caption for the trigger word. You don't have to use every socket to get value out of this one.

CategorySLK/LLM

Inputs (16)

NameTypeDefaultDescription
joy_two_pipelineJoyTwoPipeline
input_dirSTRING
output_dirSTRING
renameBOOLEANfalse
prefix_nameSTRING
start_indexINT10–9999999
extra_optionsExtra_Options
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
nameSTRING
custom_promptSTRING
low_vramBOOLEANfalse
top_pFLOAT0.900–1
temperatureFLOAT0.600–1
prefix_captionSTRING
suffix_captionSTRING

Outputs (1)

NameTypeDescription
STRINGSTRING