FL Kohya Dataset Config
Turn a ComfyUI image batch into a Kohya-ready dataset
- workspace_config
- images
- conditioning_images
- workspace_images_dir
In the manual FL-Trainer chain, FL Kohya Dataset Config is the node that turns loose images and captions into something Kohya's sd-scripts will actually eat. The trainer wants a dataset config pointing at a folder of image/caption pairs; this node builds exactly that, in the ComfyUI-native way: you wire in IMAGE tensors and caption strings, it writes them to disk and generates the dataset file.
It's the bridge between the graph and the filesystem, and it's also a quiet place where dataset quality gets decided. Kohya is unforgiving about mixed-size inputs, and this node's bucketing toggle is where you'll feel that first.
How it works
Give it images and captions and it saves every image into the workspace's train_images folder - renamed to md5 hashes so your filenames never collide - alongside a caption file for each. Then it generates dataset.json (or .toml) in the workspace describing that folder with your resolution, num_repeats, batch_size and caption_extension. The FL Kohya Train node picks that file up automatically, so after this runs you can kick off training immediately.
There's also an optional conditioning_images input. Wire tensors in and it saves them as a conditioning_data_dir, the hook used for control-style training setups. Most people never touch it.
Inputs that matter
- workspace_config - from FL Kohya Workspace. Required.
- images and captions - both required, and the captions input is force-wired, so you must connect the caption STRING output (usually from FL Kohya Data Loader) rather than type text in.
- resolution - default 1024. Images are resized so their longest side fits; pair this with your template (512-ish for SD 1.5, 1024 for SDXL).
- enable_bucket - on by default, so varied aspect ratios train properly. Off = everything gets squeezed to
resolution. - num_repeats - how many times each image is seen per epoch. Default 1; 10–30 is common for small character sets.
- caption_extension -
.captionor.txt. Use the same one your captions were written as - a mismatch silently produces captionless images. - force_clear / force_clear_only_images - wipe the workspace's
train_imagesbefore writing. Rerunning without these can leave stale images mixing into your new set. - image_format, dataset_config_extension, batch_size - set-and-forget.
The output is workspace_images_dir, a STRING with the path to the saved folder - handy for confirming where things landed (train images live under ComfyUI/output/FL_train_workspaces/<name>/train_images, not models/loras).
Install
Manager search "FL-Trainer", or git clone https://github.com/filliptm/ComfyUI_FL-Trainer into custom_nodes, restart.
Gotchas
- Mixed-size images with bucketing had a known bad patch. There's a 2024 r/StableDiffusion thread titled "enable buckets is broken": mixed-size datasets threw tensor-size errors, and the reported workaround was resizing everything to the same dimensions - which defeats bucketing's purpose. Newer builds are better, but if you hit a tensor mismatch, uniform-size inputs are the escape hatch.
- Rerunning without
force_clearaccumulates. Old hash-named images from a previous run stick around and pollute your dataset. Enable it once you've finalized your image set. - This node is a big reason EasyTrain exists - the one-node path builds its dataset internally so you never touch this. Use it when you want control over resolution, repeats, or conditioning.
Dataset quality is where LoRAs are won or lost, and this node is where that decision lives in the manual chain.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| workspace_config | FL_TT_SS_WorkspaceConfig | — | |
| images | IMAGE | — | |
| captions | STRING | — | |
| enable_bucket | COMBO | enable | 2 options: enable, disable |
| resolution | INT | 1024 | — |
| num_repeats | INT | 1 | — |
| caption_extension | COMBO | .caption | 2 options: .caption, .txt |
| batch_size | INT | 1 | — |
| force_clear | COMBO | disable | 2 options: enable, disable |
| force_clear_only_images | COMBO | disable | 2 options: enable, disable |
| image_format | COMBO | jpg | 3 options: png, jpg, webp |
| dataset_config_extension | COMBO | .json | 2 options: .toml, .json |
| conditioning_imagesopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| workspace_images_dir | STRING | — |