🌻 Flux Train Step Math
Work out your LoRA training steps before you start
- Total_Training_Steps
- Steps_Per_Epoch
A calculator for LoRA training steps. You tell it how many images you've got, how many times to repeat each, and how many epochs, and it multiplies them into a total step count. It doesn't train anything - it's a planning node - but getting that number right before you kick off a run saves you from either undercooking a LoRA or grinding compute into an overfit mess.
Why the step count matters
The core formula for training is settled and simple: total steps = images × repeats × epochs. That single number is the biggest lever on how your training turns out. Too few steps and the LoRA never really learns the subject; too many and you overfit - outputs start looking like photocopies of your training images and you lose prompt control. Since step count falls straight out of dataset size, repeats, and epochs, being able to compute it (and re-compute it the moment you add ten more images to the set) keeps your training plan honest. This node just makes that arithmetic a graph input you can feed downstream.
How it works
The three numbers map directly onto the formula. Material_Count is your image count, Training_Times_Per_Image is repeats, and Epoch is epochs. The equation field spells out the default multiplication (Material_Count * Training_Times_Per_Image * Epoch) and is editable if you want a different calculation. It returns the total and the per-epoch figure.
The inputs that matter
- Material_Count - how many images are in your dataset.
- Training_Times_Per_Image - repeats per image per epoch.
- Epoch - how many passes over the dataset.
- equation - the formula itself, editable if the default doesn't match your trainer's convention.
Two outputs: Total_Training_Steps (the headline number) and Steps_Per_Epoch (total divided across epochs - useful for setting save intervals so you snapshot at each epoch boundary).
Common issues
There's nothing to break here - it's arithmetic - so the real "issue" is judgment, not the node. Don't chase a big step count thinking more is better; overfitting comes from too many steps, too high a learning rate, or too small a dataset, and this node makes it easy to dial the total way up without thinking. A common sane starting range lands in the low thousands for a modest character or style set, but it's genuinely dataset-dependent. Use Steps_Per_Epoch to line up your checkpoint saves with epoch boundaries - the last epoch is often not the best one, so you want intermediate saves to compare. Treat this node as a planner that keeps your numbers consistent, then let your actual trainer (ai-toolkit, kohya, and friends) do the work.
Installing ComfyUI-Addoor
ComfyUI-Addoor (葵花宝典) is a utility pack from developer Eagle-CN. ComfyUI Manager: Install Custom Nodes → search "ComfyUI-Addoor" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Eagle-CN/ComfyUI-Addoor.git
cd ComfyUI-Addoor
pip install -r requirements.txt
Restart and find it under 🌻 Addoor / Utilities.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| Material_Count | INT | 101–1000000 | — |
| Training_Times_Per_Image | INT | 251–1000000 | — |
| Epoch | INT | 41–1000000 | — |
| equation | STRING | Material_Count * Training_Times_Per_Image * Epoch | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Total_Training_Steps | INT | — |
| Steps_Per_Epoch | INT | — |