admin管理员组文章数量:1567915
学习率预热
-
在预热期间,学习率从0线性增加到优化器中的初始lr。
-
在预热阶段之后创建一个schedule,使其学习率从优化器中的初始lr线性降低到0
Parameters
-
optimizer (Optimizer)
– 用于调度学习速率的优化器参数 -
num_warmup_steps (int)
– 预热阶段的步骤数 -
num_training_steps (int)
– 训练的总步骤数 -
last_epoch (int, optional, defaults to -1)
– The index of the last epoch when resuming training.
Returns
torch.optim.lr_scheduler.LambdaLR
with the appropriate schedule.
# training steps 的数量: [number of batches] x [number of epochs].
total_steps = len(train_dataloader) * epochs
# 设计 learning rate scheduler
scheduler = get_linear_schedule_with_warmup(optimizer, num_warmup_steps = 50,
num_training_steps = total_steps)
本文标签: Transformersgetlinearschedulewithwarmaup
版权声明:本文标题:学习率预热(transformers.get_linear_schedule_with_warmaup) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1725782498a1042356.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论