MinusZone - KohyaSSDatasetConfig
Turns a ComfyUI image batch into a Kohya-ready training set
- workspace_config
- images
- conditioning_images
- workspace_images_dir
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 anIMAGEbatch works.conditioning_images(optional) - required only when you're training a ControlNet: pass your preprocessed conditioning images here, same count and order asimages. 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-.captionor.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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| workspace_config | MZ_TT_SS_WorkspaceConfig | — | |
| images | IMAGE | — | |
| 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 |
| same_caption_generate | COMBO | disable | 2 options: enable, disable |
| same_caption | STRING | — | |
| image_format | COMBO | webp | 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 | — |