Dataset Prep
Batch-generate a LoRA dataset in one node run
- images
- images
- log
- count
Generating a LoRA training set used to mean queuing a single-image generator a hundred times and hoping nothing OOMs halfway through. Dataset Prep is the ZFRNodes answer to that: it takes a whole folder of references as one IMAGE batch and runs the full generation loop over every image inside a single node, saving each result to disk. One queue run instead of a hundred.
This is the unglamorous half of training, and it matters more than any hyperparameter. The standing advice is that dataset curation beats every knob in the config - so the workflow here is worth setting up once. The pack's dataset pipeline looks like: Reference Image Loader (Path) → Dataset Prep → Caption Generator, and this node is the middle of that chain.
How it works
Mechanically it's the same Flux2-style generation as the pack's Simple Image Generator (Multiple): it loads the UNET, VAE, CLIP, and optional LoRA once and reuses them across every image, which is why it's so much faster than re-running a single-image node in a loop. Two modes:
image_to_image(default) - every input image becomes a reference. Yourpromptdescribes the transform - the classic job is pushing a folder of scraped photos toward one consistent style.text_to_image- inputs are ignored; thepromptalone generatesnum_imagesfresh images (or one per input image ifnum_imagesis 0).
Each image is VAE-encoded and injected into the positive conditioning via Flux2's ReferenceLatent, the same reference mechanism the rest of the pack uses. seed_mode defaults to increment so outputs vary instead of repeating, and it frees GPU memory between images so big folders don't run out of VRAM mid-batch. Everything gets saved to disk - output_dir and filename_prefix control where and what it's called.
Inputs that matter
images- the IMAGE batch, straight from Reference Image Loader (Path).mode- the image_to_image / text_to_image switch.prompt- what you want done to (or generated from) each image.- The model loaders:
unet_name,vae_name,clip_name, andclip_type(defaultflux2). num_images- how many to produce in text-to-image mode (0= one per input).reference_size_mode-match_referencekeeps each image's own aspect ratio;fit_to_width_heightfits them into thewidth×heightbox, aspect preserved.
Outputs: images (all results as one batch, handy for a quick preview), log (per-image seed/size/save status), and count.
Install
Standard ZFRNodes install - search ComfyUI-ZFRNodes in ComfyUI Manager, or:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/zfrsgtcu/ComfyUI-ZFRNodes.git
Dependencies are just numpy, torch, and Pillow, which ComfyUI already has. Then fully restart - a browser refresh won't do, because the pack's frontend script registers on load.
Common issues
- Errors inside sampling - a
clip_typethat doesn't match the model you loaded will blow up mid-run. The pack is built and tested against flux-2-klein with a Qwen text encoder (clip_type = flux2); the i2i path relies onReferenceLatent, so models without reference-latent conditioning won't behave in image_to_image mode.text_to_imagemode still works fine. - Long runs - a big folder in one shot is a long queue. Test on a handful first (cap it upstream with
max_imageson the loader), then let the whole folder rip. - Getting captions after - note there's no graph wire between this node and Caption Generator; that one reads its own folder from disk. Run Dataset Prep, then point Caption Generator's folder picker at Dataset Prep's output folder, and you've gone from "a folder of source photos" to "a captioned dataset" in two node runs.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| mode | COMBO | image_to_image | 2 options: image_to_image, text_to_image |
| prompt | STRING | — | |
| unet_name | COMBO | 0 options: | |
| vae_name | COMBO | 0 options: | |
| clip_name | COMBO | 0 options: | |
| clip_type | COMBO | flux2 | 28 options: stable_diffusion, stable_cascade, sd3, stable_audio, mochi, ltxv, +22 |
| lora_name | COMBO | 1 options: None | |
| lora_strength | FLOAT | 1.00-10–10 | — |
| trigger_words | STRING | — | |
| width | INT | 96064–8192 | — |
| height | INT | 120064–8192 | — |
| steps | INT | 81–200 | — |
| cfg | FLOAT | 1.00–30 | — |
| guidance | FLOAT | 3.50–100 | — |
| denoise | FLOAT | 1.000–1 | — |
| sampler_name | COMBO | euler | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | simple | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 |
| seed | INT | 00–18446744073709550000 | — |
| seed_mode | COMBO | increment | 3 options: increment, fixed, random |
| reference_size_mode | COMBO | match_reference | 2 options: match_reference, fit_to_width_height |
| num_images | INT | 00–100000 | — |
| output_dir | STRING | dataset | — |
| filename_prefix | STRING | data | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| log | STRING | — |
| count | INT | — |