Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@arnavgarg1
Copy link
Contributor

@arnavgarg1 arnavgarg1 commented Aug 7, 2023

Implements Cosine Annealing: https://arxiv.org/pdf/1608.03983.pdf

CosineAnnealingWithRestarts is a scheduling technique that starts with a very large learning rate and then aggressively decreases it to a value near 0 before increasing the learning rate again. This happens either at fixed intervals, or are growing intervals, both of which can be configured.

To enable cosine learning rate scheduling with warm restarts, you can set:

trainer:
    learning_rate_scheduler:
        decay: cosine

There are 3 optional parameters that you can configure:

  • T_0: The number of steps before warm restarts. Defaults to steps_per_checkpoint if not specified.
  • T_mult: Period between warm restarts. Defaults to 1. If set to 2 or greater, it multiplies the current interval by the multiplier between warm restarts. For e.g., if T_0 is 20 steps and T_mult is 2, then the periods between restarts will be 20, 40, 80, 160, ....
  • eta_min: The minimum learning rate the LR should be decayed to. Defaults to 0.

This PR also refactors the way the learning rate schedulers are configured, using a new SequentialLR object.

@github-actions
Copy link

github-actions bot commented Aug 8, 2023

Unit Test Results

  6 files  ±0    6 suites  ±0   1h 1m 32s ⏱️ - 3m 15s
34 tests ±0  29 ✔️ ±0    5 💤 ±0  0 ±0 
88 runs  ±0  72 ✔️ ±0  16 💤 ±0  0 ±0 

Results for commit c297a99. ± Comparison against base commit ccbf5de.

♻️ This comment has been updated with latest results.

@arnavgarg1 arnavgarg1 marked this pull request as ready for review August 8, 2023 02:05
@tgaddair tgaddair merged commit b0bba7c into master Aug 8, 2023
@tgaddair tgaddair deleted the cosine branch August 8, 2023 05:58
dennis-rall pushed a commit to dennis-rall/ludwig that referenced this pull request Aug 9, 2023
dennis-rall pushed a commit to dennis-rall/ludwig that referenced this pull request Aug 9, 2023
justinxzhao added a commit that referenced this pull request Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants