| lr_scheduler_warmup_cosine | R Documentation |
Raises the learning rate linearly from warmup_start_lr to the
optimizer's initial lr over warmup_steps steps, then anneals it
to lr_min following a cosine curve over the remaining
total_steps - warmup_steps steps. This is the standard transformer
training schedule. Call $step() per batch.
lr_scheduler_warmup_cosine(
optimizer,
warmup_steps,
total_steps,
lr_min = 0,
warmup_start_lr = 0
)
optimizer |
Optimizer environment. Its current |
warmup_steps |
Number of linear warmup steps. |
total_steps |
Total number of |
lr_min |
Final learning rate after annealing (default 0). |
warmup_start_lr |
Learning rate at step 0 (default 0). |
An lr_scheduler_warmup_cosine environment with $step()
and $get_lr().
w <- ag_param(matrix(runif(4), 2, 2))
opt <- optimizer_adam(list(w = w), lr = 1e-3)
sch <- lr_scheduler_warmup_cosine(opt, warmup_steps = 10L, total_steps = 100L)
for (i in 1:100) sch$step()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.