FL Kohya Data Loader
The tiny loader that feeds the whole trainer
- images
- captions
FL Kohya Data Loader is the unglamorous front end of the FL-Trainer pack: a folder path goes in, and out come images (an IMAGE batch) and captions (a matching STRING list) that you wire into FL Kohya Dataset Config. Nothing clever, and that's exactly what it should be. If the workspace node is the plumbing, this is the garden hose.
It exists because training data lives on disk, not in the graph, and Kohya wants images paired with same-name caption files. This node is the adapter between those two worlds.
How it works
You give it a directory and a caption extension (.txt by default, or .caption). It scans for .png, .jpg, .webp, and .jpeg files, and for each image it looks for a caption file sharing the same name - portrait.jpg pairs with portrait.txt. It returns every image that has a matching caption, plus the captions in the same order.
That last part is the detail worth remembering: images without a caption file are simply dropped, silently. The loader is deliberately strict because Kohya training with a missing caption means training with a garbage caption, so it'd rather skip than guess.
Inputs and outputs
Only two inputs:
- directory - the folder path, a plain string. No file-picker widget; paste the path in.
- caption_extension -
.txt(default) or.caption, matching however your captions are saved.
Outputs are images and captions, which feed FL Kohya Dataset Config's required images and captions inputs. That's the whole wiring - it's the two upstream wires of the manual training chain.
Install
It ships in the same pack, so: Manager search "FL-Trainer", or git clone https://github.com/filliptm/ComfyUI_FL-Trainer into custom_nodes, restart.
Gotchas
- A missing directory isn't an error - it returns empty tensors and an empty caption list, and the downstream node fails somewhere confusing later. Double-check your path.
- Uncaptioned images disappear. If your folder has 30 images but only 20
.txtfiles, you're training on 20 images and there's no warning about the other 10. When your LoRA comes out weak, count captions first. - Stems must match exactly (
portrait.jpg/portrait.txt, notportrait_01/portrait 01.txt). - The loader does no resizing - that's the dataset node's job downstream. It'll happily hand you a 4K image;
resolutionand bucketing happen in FL Kohya Dataset Config.
Also worth knowing: FL Kohya Easy Train uses the exact same loading logic internally. So if the one-node path works for you, you never see this node at all - but understanding its "caption-or-skip" rule is exactly how you diagnose EasyTrain training an empty dataset.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | X://path/to/images | — |
| caption_extension | COMBO | .txt | 2 options: .caption, .txt |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| captions | STRING | — |