Flux Train Loop
The node that actually grinds training steps
- network_trainer
- network_trainer
- steps
The Init node sets your training run up; FluxTrainLoop is the node that does the actual work. It runs a chunk of training steps and hands the trainer back so you can do something with it - validate, save, or just loop again. It's the engine that turns "I configured a train" into "I'm training."
The clever bit of this whole pack is that the training loop is exposed as a node you chain, instead of one opaque "train now" button. That's what lets you build a graph that trains for a bit, samples a preview, trains more, saves a checkpoint, trains more - all visible on the canvas. It's the "build workflows to compare settings" pitch made concrete.
How it works
FluxTrainLoop takes a network_trainer (NETWORKTRAINER, straight from an Init node's output) and a steps count, runs exactly that many training steps, and outputs the advanced network_trainer plus the steps count. Because the trainer object flows in and back out, you daisy-chain these: Init → Loop(500) → Validate → Loop(500) → Save → Loop(500) → End. Each Loop picks up where the last one left off.
The two inputs are the whole node:
network_trainer- the trainer from Init (or from a previous Loop/Validate/Save in the chain). This is what carries all your state forward.steps(default 1) - how many steps this segment runs. In practice you set this to however often you want to pause and check in - say 250 or 500 - rather than 1.
Why you'd split the loop
You don't have to train in one shot. Splitting the run into Loop segments is how you get intermediate checkpoints and preview samples, and that matters because - as every LoRA guide will tell you - the last checkpoint is often not the best one. Save every few hundred steps, generate a validation image at each, and you can pick the checkpoint where likeness peaked before overfitting set in. One long unbroken loop robs you of that choice.
Installing the pack
ComfyUI Manager: search ComfyUI Flux Trainer, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-FluxTrainer
pip install -r ComfyUI-FluxTrainer/requirements.txt
Torch 2.4.0+ recommended. The example workflows use kijai's ComfyUI-KJNodes for the surrounding graph, so install that alongside.
Common issues
You set steps to 1 and nothing seems to happen. The default is literally 1 step, which is basically a no-op for a real train. Bump it to a meaningful segment size.
Total steps is the sum of your Loops. If you chain three Loops of 500, you trained 1,500 steps - not 500. Keep a running tally so you land near the Flux sweet spot (roughly 1,500-3,000 steps for a 15-25 image set) rather than blowing past it into overfitting.
Progress feels invisible. Training doesn't stream images the way sampling does; the feedback comes from pairing Loop with FluxTrainValidate (preview samples) and VisualizeLoss (a loss curve). If you want to see it working, wire those in between your Loop segments.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| network_trainer | NETWORKTRAINER | — | |
| steps | INT | 11–10000 | the step point in training to validate/save |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| network_trainer | NETWORKTRAINER | — |
| steps | INT | — |