Joy_caption_alpha_batch_Dirs
Per-folder captioning that reads your trigger from the folder name
- JoyPipeline_alpha
- STRING
If Joy_caption_alpha_batch automates the boring part of one dataset, this node automates the boring part of many. Joy_caption_alpha_batch_Dirs walks every subfolder under img_dir, captions each one with JoyCaption Alpha Two, and - here's the trick - pulls the trigger word out of the folder name itself. The README's rule: name your folders 名字_trigg (name_trigger), e.g. blue_jacket_ohwx. The node splits on the underscore and uses the second part as the activation word for everything in that folder.
This is a quality-of-life node for people managing a whole wardrobe of clothing LoRAs or a batch of character sets at once, where every subfolder is its own training dataset with its own trigger. Instead of running the single-folder batch once per dataset and manually retyping the trigger each time, you name the folders right and hit Run once.
How it works
For each subdirectory of img_dir it runs the same Alpha Two captioning loop as Joy_caption_alpha_batch, but:
triggercomes fromget_trigger_from_string(subdir)- split the folder name on_, take the second part.mydataset_xyz→ triggerxyz.- Output lands in
save_dir/<subdir>/, preserving the per-dataset structure. - Files are written as
trigger_<n>.txt(containingtrigger,<caption>) andtrigger_<n>.<format>.
If the folder name has no underscore, no trigger is written - captions still get saved, just without the activation prefix. Keep your folder names consistent if you want every caption to carry the trigger.
Inputs
JoyPipeline_alpha- fromJoy_caption_alpha_load.img_dir- parent folder; each subfolder is treated as a dataset.save_dir- mirrored output structure, one subfolder per dataset.prompt- default descriptive, or wire in aJoy_caption_alpha_promptfor styled captions.format(png/jpg),max_new_tokens,temperature,cache,low_vram,seed- same semantics as the single-folder batch: setcache=Truefor a real multi-folder run,low_vram=Trueif the captioner is OOMing next to your checkpoint.
Output is a STRING that's effectively a completion marker; the real work lands on disk.
Installing
Same pack install - ComfyUI Manager (search "Comfyui_CXH_joy_caption") or:
cd ComfyUI/custom_nodes
git clone https://github.com/StartHua/Comfyui_CXH_joy_caption
cd Comfyui_CXH_joy_caption
python -m pip install -r requirements.txt
Restart, and make sure the Alpha Two checkpoint is at models/Joy_caption_alpha/ (manual download - see Joy_caption_alpha_load).
Gotchas
- No underscore, no trigger. The node quietly captions without the activation word, and you may not notice until you're reviewing captions later.
- Empty subfolder raises
FileNotFoundError. Check your dataset tree before a long run. cache=Falsedefault means the model reloads between images - on a many-folder job that's hours of waiting. Flip it on.- NVIDIA only, as with the whole pack.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| JoyPipeline_alpha | JoyPipeline_alpha | — | |
| img_dir | STRING | — | |
| save_dir | STRING | — | |
| prompt | STRING | A descriptive caption for this image | — |
| format | COMBO | 2 options: png, jpg | |
| max_new_tokens | INT | 102410–4096 | — |
| temperature | FLOAT | 0.700–1 | — |
| cache | BOOLEAN | false | — |
| low_vram | BOOLEAN | false | — |
| seed | INT | 6565450–1000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |