Joy_caption_alpha_batch
Dataset labeling with JoyCaption Alpha Two and a trigger word
- JoyPipeline_alpha
- STRING
This is the node that makes the pack worth installing for anyone training LoRAs: point it at a folder of images and it captions every one with JoyCaption Alpha Two, writes a matching .txt next to each image, and prepends your trigger word to every caption. That's the entire boring, soul-destroying part of dataset preparation, automated.
The README frames it as batch marking ("批量打标") and quotes ~4–5 seconds per image on a 4090. For a typical 20–30 image LoRA set you're done in a couple of minutes.
What it does
For each image in img_dir it runs the Alpha Two pipeline (SigLIP → adapter → Llama), then writes two files into save_dir:
trigger_<n>.txt- containingtrigger,<caption>trigger_<n>.<format>- a copy of the image, renamed to match
The trigger field (default "trigger") is your training activation word. So with trigger=ohwx every caption becomes ohwx, a woman standing in... - exactly the format LoRA trainers want, with the activation baked in. The numbered rename keeps images and captions paired even if your originals had awkward names.
The inputs that matter
JoyPipeline_alpha- fromJoy_caption_alpha_load.img_dir- folder of source images.save_dir- where labeled pairs go.trigger- the activation word, prepended to every caption.prompt- wire aJoy_caption_alpha_promptoutput here for styled captions, or leave the descriptive default.format- png or jpg output.max_new_tokens,temperature- generation controls.cache,low_vram,seed- same semantics asJoy_caption_alpha_run(see that article):cache=Truekeeps the ~10 GB pipeline resident for a big batch;low_vram=Trueunloads your diffusion models first so the captioner can breathe.
There's no meaningful output - a STRING comes out but it's not a per-image caption; the real results land on disk.
Installing
Standard 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
Then restart and make sure the Alpha Two checkpoint is in models/Joy_caption_alpha/ (manual download - see the Joy_caption_alpha_load article).
Troubleshooting
- "Directory cannot be found": the node does a literal
os.path.isdircheck and raisesFileNotFoundError. Absolute paths work; make sure the folder exists before you hit Run. - Slow batch:
cacheisFalseby default, so the model unloads after every single image - brutally slow on a large folder. Flipcache=Truefor a real batch run. - Trigger word gotcha: if you change the trigger mid-run, previously written
.txtfiles don't get renamed. Clean thesave_dirbefore re-running. - Only NVIDIA, as with everything in this pack.
- For multi-folder datasets with per-folder triggers, use
Joy_caption_alpha_batch_Dirsinstead - it derives the trigger from the folder name.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| JoyPipeline_alpha | JoyPipeline_alpha | — | |
| img_dir | STRING | — | |
| save_dir | STRING | — | |
| trigger | STRING | trigger | — |
| 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 | — |