| 315 | |
| 316 | |
| 317 | def _add_learning_rate_args(parser): |
| 318 | group = parser.add_argument_group(title='learning rate') |
| 319 | |
| 320 | group.add_argument('--lr', type=float, default=None, |
| 321 | help='Initial learning rate. Depending on decay style ' |
| 322 | 'and initial warmup, the learing rate at each ' |
| 323 | 'iteration would be different.') |
| 324 | group.add_argument('--lr-decay-style', type=str, default='linear', |
| 325 | choices=['constant', 'linear', 'cosine', 'exponential'], |
| 326 | help='Learning rate decay function.') |
| 327 | group.add_argument('--lr-decay-iters', type=int, default=None, |
| 328 | help='number of iterations to decay learning rate over,' |
| 329 | ' If None defaults to `--train-iters`') |
| 330 | group.add_argument('--lr-decay-tokens', type=int, default=None, |
| 331 | help='Learning rate decay tokens.') |
| 332 | group.add_argument('--min-lr', type=float, default=0.0, |
| 333 | help='Minumum value for learning rate. The scheduler' |
| 334 | 'clip values below this threshold.') |
| 335 | group.add_argument('--warmup', type=float, default=0.01, |
| 336 | help='Percentage of total iterations to warmup on ' |
| 337 | '(.01 = 1 percent of all training iters).') |
| 338 | group.add_argument('--warmup-iters', type=int, default=None, |
| 339 | help='Number of iterations for LR warmup.' |
| 340 | 'If not None will override `--warmup`') |
| 341 | group.add_argument('--override-lr-scheduler', action='store_true', |
| 342 | help='Reset the values of the scheduler (learning rate,' |
| 343 | 'warmup iterations, minimum learning rate, maximum ' |
| 344 | 'number of iterations, and decay style from input ' |
| 345 | 'arguments and ignore values from checkpoints. Note' |
| 346 | 'that all the above values will be reset.') |
| 347 | group.add_argument('--use-checkpoint-lr-scheduler', action='store_true', |
| 348 | help='Use checkpoint to set the values of the scheduler ' |
| 349 | '(learning rate, warmup iterations, minimum learning ' |
| 350 | 'rate, maximum number of iterations, and decay style ' |
| 351 | 'from checkpoint and ignore input arguments.') |
| 352 | |
| 353 | return parser |
| 354 | |
| 355 | |
| 356 | def _add_checkpointing_args(parser): |