Skip to content

linear_with_warmup

allennlp.training.learning_rate_schedulers.linear_with_warmup

[SOURCE]


LinearWithWarmup#

@LearningRateScheduler.register("linear_with_warmup")
class LinearWithWarmup(PolynomialDecay):
 | def __init__(
 |     self,
 |     optimizer: torch.optim.Optimizer,
 |     num_epochs: int,
 |     num_steps_per_epoch: int,
 |     warmup_steps: int = 100,
 |     last_epoch: int = -1
 | ) -> None

Implements a learning rate scheduler that increases the learning rate to lr during the first warmup_steps steps, and then decreases it to zero over the rest of the training steps.