π UTF-8 Caption Saver
A caption .txt writer that leaves your LoRA dataset alone
- file_path
If you've ever caption-trained a LoRA, you know the drill: every image needs a matching .txt file, named exactly like it, containing nothing but the caption. No timestamps, no metadata, no ComfyUI workflow blob. The trainer just wants clean text sitting next to clean images. UTF-8 Caption Saver is a small output node that does exactly that one job, and nothing else.
It lives in DenRakEiw_Nodes, a grab-bag pack from the Civitai creator DenRakEiw (best known around here for his Flux upscaling work and the Skin Refiner LoRA). It's about as simple as a ComfyUI node gets: three text fields in, one file path out.
What it actually does
Wire in your caption, a folder, and a filename, and it writes a UTF-8 .txt file. Under the hood it sanitizes the filename (spaces and the usual <>:"/\|?* characters become underscores), appends .txt, creates the folder if it doesn't exist, and writes the text with no timestamp and no extra data. Because it's flagged as an output node, it executes every run - it won't be silently skipped by ComfyUI's caching.
The output is a single file_path string. You can ignore it, or wire it into a text/note node if you want to see where things landed.
The inputs that matter
There are only three, all plain text fields:
- caption_text - the caption itself. Multiline, so you can write full sentences or tag lists.
- folder_path - where the file goes. Here's the gotcha: relative paths get
output/prepended, so the defaultoutput/captionsactually lands you inoutput/output/captions. Set it tocaptionsto getoutput/captions, or just type an absolute path and skip the whole question. - filename - no extension needed; it's cleaned and
.txtis added for you.
It also overwrites same-named files silently. That's a feature, not a bug: rerun and the .txt refreshes to match the .png your Save Image node just wrote, which is exactly the behavior a dataset build wants.
Where it fits
In the training-data pipeline. Captioning is one of the highest-leverage things you do in LoRA training - caption what should stay variable, leave the fixed stuff out of the description. If you caption inside ComfyUI (JoyCaption, an LLM node, or just by hand), this node is the glue that gets those captions out of the graph and into your dataset folder as proper image.txt files. It's a tool for its own author's workflow, and that shows: it assumes you know exactly what you're feeding a trainer.
Gotchas and install
On failure it doesn't crash the graph - it returns the error text as file_path and prints [UTF8CaptionSaver] ... lines to the console. So if nothing shows up on disk, check the log before you panic.
Installation is the standard pack route, via ComfyUI Manager (search "DenRakEiw_Nodes") or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/DenRakEiw/DenRakEiw_Nodes
cd DenRakEiw_Nodes
pip install -r requirements.txt
One honest caveat: this node needs no extra dependencies at all - plain Python file writing. The pack's requirements.txt drags in kornia, diffusers==0.32.2, and OpenCV for its other nodes, so expect that heavy install step anyway.
Verdict: it won't caption anything for you, but that's the point. If you're assembling datasets and want captions to land exactly where your trainer expects them, it's a nice, boring utility.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| caption_text | STRING | Enter caption text here... | β |
| folder_path | STRING | output/captions | β |
| filename | STRING | caption | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_path | STRING | β |