Nodes/ComfyUI-TrainTools-MZ/MinusZone - KohyaSSDatasetConfig
ComfyUI Node

MinusZone - KohyaSSDatasetConfig

Turns a ComfyUI image batch into a Kohya-ready training set

By MinusZoneAI·Created 2 years ago·Updated 5 months ago· 67
MinusZone - KohyaSSDatasetConfig
  • workspace_config
  • images
  • conditioning_images
  • workspace_images_dir
enable_bucketenable
resolution1024
num_repeats1
caption_extension.caption
batch_size1
force_cleardisable
force_clear_only_imagesdisable
same_caption_generatedisable
same_caption
image_formatwebp
dataset_config_extension.json

Dataset preparation is where most first LoRA runs go to die, and this node is the pack's answer to that. MZ_KohyaSSDatasetConfig takes the images you've assembled in your graph, resizes them to your training resolution, writes them into the workspace, and generates the dataset config (.json or .toml) that sd-scripts reads when training starts. If you've ever hand-assembled a kohya dataset folder, this replaces the fiddly parts.

The pack is built around kohya-ss/sd-scripts, so everything here speaks that vocabulary: enable_bucket, num_repeats, caption_extension. The good news is the KB's LoRA training doc says the fundamentals don't change between models - diverse backgrounds, caption what you want to vary, more repeats doesn't fix bad data. This node just makes the plumbing of those fundamentals painless.

How it works

You feed it the workspace_config from MZ_KohyaSSInitWorkspace plus an IMAGE batch. It writes each image into train_images/ inside the workspace, resizing the long side to resolution (default 1024), and filenames are md5 hashes of the pixel data so re-running doesn't duplicate. Then it writes the dataset config that points sd-scripts at that folder. The output is workspace_images_dir - a STRING path you can hand to a ShowText node if you want to confirm where your data landed.

Inputs that actually matter

  • images - the training images. The README recommends feeding this from the upload-folder node in ComfyUI-VideoHelperSuite, but anything that produces an IMAGE batch works.
  • conditioning_images (optional) - required only when you're training a ControlNet: pass your preprocessed conditioning images here, same count and order as images. The node's own description is blunt about this: "if the training type is controlnet, the preprocessed images (conditioning_images) must be passed in."
  • enable_bucket (default enable) - lets kohya train at multiple resolutions; leave it on.
  • num_repeats - how many times each image is shown per epoch. Start at 1 for character work.
  • caption_extension - .caption or .txt. Whatever the captioner downstream writes must match.
  • same_caption_generate + same_caption - writes the same caption file for every image. A blunt instrument, but useful when you just want one trigger-word file and your real captions come later.

The remaining ones (force_clear, force_clear_only_images, image_format, batch_size, dataset_config_extension) are set-and-forget.

Install & troubleshooting

Install the pack via ComfyUI Manager (search ComfyUI-TrainTools-MZ) or:

cd ComfyUI/custom_nodes
git clone https://github.com/MinusZoneAI/ComfyUI-TrainTools-MZ
# restart ComfyUI

The classic gotcha: this node is also registered under the older name MZ_ImagesCopyWorkspace - same class, two labels, so don't panic if you see both. If your training runs with zero samples or a "dataset not found" style error, check that the workspace_images_dir from this node actually wired into the train node; it's a plain string that must flow forward. And if you switch image_format to webp (the default!), remember sd-scripts needs pillow support for webp - nearly always fine, but it's the first thing that breaks on a stripped-down Python.

CategoryMinusZone - TrainTools/kohya_ss

Inputs (14)

NameTypeDefaultDescription
workspace_configMZ_TT_SS_WorkspaceConfig
imagesIMAGE
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
same_caption_generateCOMBOdisable2 options: enable, disable
same_captionSTRING
image_formatCOMBOwebp3 options: png, jpg, webp
dataset_config_extensionCOMBO.json2 options: .toml, .json
conditioning_imagesoptIMAGE

Outputs (1)

NameTypeDescription
workspace_images_dirSTRING