πΎ LoRA Caption Saver
Your LoRA Captions, Saved to Disk Without a Script
- images
- image
- caption
Every LoRA trainer worth using wants the same thing: one folder of images, each with a same-named .txt caption beside it. Kohya reads the sidecars automatically; SimpleTuner reads them if you set caption_strategy: textfile. That pairing is the entire training-data contract, and it's also the part everyone's pipeline fumbles. The classic ComfyUI way was SaveImage plus SaveText|pysssss writing into two separate folders, then a post-processing script to rename and re-pair them - a script that breaks the moment your filename counter drifts between the image and the text.
πΎ LoRA Caption Saver is the end of that dance. It's an output node that writes the PNG and the matching .txt caption in one save step, from the same filename counter, so the pair can't fall out of sync. No post-processing, no script, no guessing.
What it needs
Three required inputs, and they're all straightforward:
images- the IMAGE tensor from your VAE Decode.caption- a STRING, marked as a force-input, which is worth knowing: the node requires this to be wired. The intended source is aFlorence2Runnode from the comfyui-florence2 pack doing auto-captioning, but any STRING node works.filename_prefix- where things land. Connect this toLoRADatasetConfig.output_prefixand you getlora_dataset/<name>/<name>automatically; or type it by hand.
The one optional input is trigger_word - connect LoRADatasetConfig.trigger here and it's prepended to the caption. Leave it empty and the caption is written as-is.
What you get back
Two outputs, both modest: image is a pass-through so you can chain a preview node, and caption is the exact final string that was written to disk (trigger_word, <caption>), handy for a ShowText|pysssss preview before you commit to a run.
On disk you get pairs like this in ComfyUI/output/lora_dataset/<name>/:
my_character_00001_.png
my_character_00001_.txt
my_character_00002_.png
my_character_00002_.txt
The .txt is a single line - my_character, The image shows a woman standing confidently in a forest clearing... - which is exactly the format kohya_ss and SimpleTuner expect. The PNG also gets the full workflow metadata embedded in its EXIF, which is a nice-to-have for reproducing runs later.
One honest caveat on "atomic": it's not a filesystem-level atomic write, it's a same-pass save from one counter. The base filename is computed once and shared by both files, so the pairing is guaranteed even though the two writes happen sequentially. Good enough for the job.
Installing and the captioning model
Same install as the rest of the pack: ComfyUI Manager (search "LoRA Dataset Tools") or:
cd ComfyUI/custom_nodes
git clone https://github.com/LordTaylor/comfyui-lora-dataset-tools.git
The node itself has no Python dependencies. But to feed it captions you need the comfyui-florence2 pack and the Florence-2-base model in models/LLM/Florence-2-base/ - that's a real download, and if your example workflows aren't loading, that model folder is the first place to look. The full install.sh also pulls IPAdapter Plus, Custom Scripts, the IP-Adapter weights, and a CLIP vision encoder; bridgeToonsMix.v80 comes from CivitAI by hand.
Gotchas worth knowing
Because caption is a force-input, a beginner's first run often fails with an unconnected red socket - wire Florence2 and you're fine. And don't skip trigger_word. It's optional, so it's easy to forget, but a dataset captioned without the trigger word trains a LoRA that won't actually activate at inference. The pack's other node makes that wiring trivial: LoRADatasetConfig.trigger β here, LoRADatasetConfig.output_prefix β filename_prefix, and the folder is training-ready the moment you stop queueing.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | β | |
| caption | STRING | Caption from Florence2Run (or any STRING). | |
| filename_prefix | STRING | lora_dataset/char_NAME/char_NAME | Connect to LoRADatasetConfig.output_prefix for auto-naming, or type manually: lora_dataset/<name>/<name> |
| trigger_wordopt | STRING | Connect to LoRADatasetConfig.trigger. Prepended to caption in the .txt file. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| caption | STRING | β |