mojolearn.ExponentialLR#
- class mojolearn.ExponentialLR(base_lr, gamma)[source]#
Bases:
_PowSchedExponential learning-rate schedule: multiply by
gammaevery step.Computes torch’s
ExponentialLRclosed form,lr = base_lr * gamma ** epoch, as a function of the step index.lr_at(t)takes the one-based optimizer step (lr_at(1)isbase_lr). Each value is the exact closed form rounded once to float32 (ties to even, values below the smallest normal flushed to +0.0), so a schedule gives the same bits on every machine.Pass it as
lr_schedule=toRMSprop,Adagrad,Lion,Adamax,NAdamand the recurrent estimators.- Parameters:
base_lr (float) – Learning rate of the first step. Must be finite.
gamma (float) – Multiplicative decay factor per step. Must be finite.
Notes
lr_at(t)raisesValueErrorfort < 1andOverflowErrorwhen the value overflows float32.Examples
>>> import mojolearn >>> sched = mojolearn.ExponentialLR(0.01, gamma=0.95) >>> lrs = sched.lrs(100)
Methods
bits_at(t)lr_at(t)lr_values(n)lr_at(1) .
lrs(n)lr_at(1) .