Nodes/ComfyUI_FL-Trainer/FL Kohya Dataset Config
ComfyUI Node

FL Kohya Dataset Config

Turn a ComfyUI image batch into a Kohya-ready dataset

By filliptm·Created 2 years ago·Updated 4 months ago· 178
FL Kohya Dataset Config
  • workspace_config
  • images
  • conditioning_images
  • workspace_images_dir
captions
enable_bucketenable
resolution1024
num_repeats1
caption_extension.caption
batch_size1
force_cleardisable
force_clear_only_imagesdisable
image_formatjpg
dataset_config_extension.json

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 - .caption or .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_images before 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_clear accumulates. 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.

Category🏵️Fill Nodes/Training

Inputs (13)

NameTypeDefaultDescription
workspace_configFL_TT_SS_WorkspaceConfig
imagesIMAGE
captionsSTRING
enable_bucketCOMBOenable2 options: enable, disable
resolutionINT1024
num_repeatsINT1
caption_extensionCOMBO.caption2 options: .caption, .txt
batch_sizeINT1
force_clearCOMBOdisable2 options: enable, disable
force_clear_only_imagesCOMBOdisable2 options: enable, disable
image_formatCOMBOjpg3 options: png, jpg, webp
dataset_config_extensionCOMBO.json2 options: .toml, .json
conditioning_imagesoptIMAGE

Outputs (1)

NameTypeDescription
workspace_images_dirSTRING