Pto Lr Scheduler Step
Pto Lr Scheduler Step drops the rate every N epochs
- optimizer
- PTLRSCHEDULER
PtoLrSchedulerStep wraps PyTorch's StepLR - the simplest scheduled decay in the book: every step_size epochs, the learning rate gets multiplied by gamma. No looking at the loss, no curves, just a metronome. It's the oldest trick in the scheduler drawer and still perfectly valid when you have a known epoch budget and want predictable, legible decay.
Why you'd reach for it
Compared to the pack's other two schedulers, this one trades cleverness for predictability. Cosine annealing gives you a smooth arc but assumes you know when training ends; reduce-on-plateau reacts to the loss but adds a knob you have to tune. StepLR is the "I know this run is exactly 50 epochs and I want the rate to halve at epoch 20 and 40" option - deterministic, easy to reason about, easy to replicate. It's also the least fiddly to hand-tune in a table: each step is a discrete, documented drop. If you're porting a recipe you saw somewhere ("drop LR at 60% and 80% of training"), this is the node that expresses it.
Inputs
- optimizer (PTOPTIMIZER) - the optimizer to schedule, from any
Pto*node. - step_size - the period in epochs between drops. The default 10 means "decay every 10 epochs."
- gamma - the multiplicative factor per drop. Default
0.1(a 90% cut) is aggressive; classic schedules often use0.5. Withgamma=0.5andstep_size=20, the rate halves every 20 epochs.
Output is a single PTLRSCHEDULER, wired into a training node that accepts schedulers.
The thing people get wrong
step_size is in epochs, so it only makes sense relative to how long your run actually is. Setting step_size=10 on a 15-epoch run gives you exactly one decay; on a 100-epoch run it gives you nine. That's the intended knob, but it's easy to copy a step_size from someone else's run and have it land completely differently in yours. Also note this scheduler is blind - it decays on schedule even if the loss is still falling fast, which is the tradeoff you're accepting for the predictability. If your data or training length varies between runs, the pack's reduce-on-plateau scheduler is the more forgiving sibling.
Installing it
Part of ComfyUI-Pt-Wrapper (HowToSD's no-code PyTorch pack, a spin-off of ComfyUI-Data-Analysis). ComfyUI Manager → search "ComfyUI-Pt-Wrapper", or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart after; first boot is slow while pandas, scikit-learn, transformers, sentencepiece, peft and friends install. No model files needed.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| optimizer | PTOPTIMIZER | — | |
| step_size | INT | 101–100000000 | — |
| gamma | FLOAT | 00.000001–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PTLRSCHEDULER | PTLRSCHEDULER | — |