ParlAI icon indicating copy to clipboard operation
ParlAI copied to clipboard

Early stopping and finetuned optimizer state

Open lightvector opened this issue 2 years ago • 4 comments

Patch description Adds some additional flags that allow some more flexible uses of ParlAI for running experiments when finetuning models and starting/stopping runs to change between similar datasets or different training parameters with the same model.

--preserve-optimizer-for-finetuning - during a finetuning run, preserve the optimizer state from the prior run. This can be important for ADAM to not take erroneous steps when starting training again from the model from a prior run. --early-stop-at-n-steps - Stop training early at n steps. This can be convenient for launching a run in several parts, swapping out the dataset or parameters in the middle of a run after n steps, etc, while still obeying the learning rate schedule and/or any other settings that would be used in a longer run.

Testing steps Added a short integration test for --early-stop-at-n-steps to test_lr_schedulers.py. For --preserve-optimizer-for-finetuning I'm a little bit at a loss as to how to test it in a more automated way. I used essentially this change for my own project, but someone has any suggestions how one would more standardly test within the test framework for this library, or even what dataset/model/command would be a good baseline, please feel free to comment.

lightvector avatar Jun 28 '22 21:06 lightvector

@c-flaherty

lightvector avatar Jun 28 '22 21:06 lightvector

@lightvector Note for later: Turning these flags on may break requeue-ability (because lr scheduler state is destroyed on job initialization). We need to look into that before merging this

c-flaherty avatar Jul 27 '22 16:07 c-flaherty

This PR has not had activity in 30 days. Closing due to staleness.

github-actions[bot] avatar Aug 27 '22 00:08 github-actions[bot]

@c-flaherty @lightvector is there any update on this?

klshuster avatar Sep 12 '22 13:09 klshuster

This PR has not had activity in 30 days. Closing due to staleness.

github-actions[bot] avatar Oct 13 '22 00:10 github-actions[bot]