Flux Train And Validate Loop
Run training and preview it as it goes
- network_trainer
- validation_settings
- network_trainer
- steps
This is the engine room of a ComfyUI-FluxTrainer run. It's the node that actually grinds through your training steps, and - this is the good bit - pauses at intervals to generate sample images so you can watch the LoRA learn instead of flying blind and praying at the end. If you've ever trained a LoRA elsewhere, waited an hour, and discovered it overcooked at step 800, this node is the fix for that specific pain.
Why you'd reach for it
Training is a slow, expensive gamble, and the single most useful thing you can do is look at intermediate results. The LoRA-training playbook is blunt about it: the final checkpoint is frequently not your best one, so you save along the way and compare. This node bakes that discipline into the graph - it interleaves training and validation on a fixed cadence, so you're not just accumulating steps, you're accumulating steps and getting periodic proof of where the run is heading. Catch overfitting at step 1,500 and you've saved yourself the back half of the run.
How it works
It takes the live training session (the NETWORKTRAINER object threaded through FluxTrainer graphs) and runs it forward. Two counters govern the rhythm: it fires a validation pass every so many steps, and (in the typical setup) saving happens on its own interval too. When a validation checkpoint hits, it renders sample images using whatever generation settings you handed it, then resumes training from exactly where it left off. The trainer object comes back out so you can chain more of these, or a save node, downstream.
The inputs that matter
- validate_at_steps - how often it stops to generate previews. Default 250. Smaller means more frequent snapshots (more visibility, more time spent rendering instead of training); larger means fewer interruptions. For a short character run, previewing every 250 steps is reasonable; for a long run you might widen it.
- save_at_steps - the interval for writing checkpoints. Default 250. Line this up sensibly with your validation cadence so the version you see is a version you can actually load.
- validation_settings (optional) - plug a
FluxTrainValidationSettingsnode in here to control the preview images: resolution, steps, guidance, seed, the shift parameters. Leave it unconnected and it'll use built-in defaults, but wiring it in is worth it - a fixed seed across checkpoints means you're comparing like with like.
Outputs are network_trainer (keep chaining) and steps (the current step count).
Installing ComfyUI-FluxTrainer
Via ComfyUI Manager: search "ComfyUI Flux Trainer", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-FluxTrainer
cd ComfyUI-FluxTrainer
pip install -r requirements.txt
Restart ComfyUI. Use torch 2.4.0 or newer - this is real training code. For LoRA training the models must be the normal fp8 or fp16 files, and crucially the VAE has to be the non-diffusers ae.safetensors from the FLUX.1-dev repo, not a diffusers-format one. The example workflow leans on ComfyUI-KJNodes and optionally rgthree-comfy for debug nodes.
Common issues
The most common confusion is expecting this node to define your dataset, model, or hyperparameters - it doesn't. It's the loop that runs a training session that was already assembled upstream (dataset nodes, model select, the init/optimizer config). If your run errors instantly, the problem is almost always in that setup, not here.
Validation isn't free. Every preview pass is a small generation job, so an aggressive validate_at_steps on a big-resolution validation setting eats real time that could've been training. If a run feels weirdly slow, check you're not previewing every 50 steps at 1024px.
And keep the wider context in mind: ComfyUI-FluxTrainer is a Flux-era wrapper around kohya's scripts, and it's experimental by the author's own admission. It still works and it's genuinely handy if you want to train without leaving ComfyUI, but if you're chasing the last few percent of quality, most people have drifted to dedicated trainers. The validate-as-you-go loop, though, is exactly the kind of thing that keeps a run honest - use it.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| network_trainer | NETWORKTRAINER | — | |
| validate_at_steps | INT | 2501–10000 | the step point in training to validate/save |
| save_at_steps | INT | 2501–10000 | the step point in training to validate/save |
| validation_settingsopt | VALSETTINGS | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| network_trainer | NETWORKTRAINER | — |
| steps | INT | — |