[WIP] Add patience argument to run_language_modeling script#2840
Closed
thesamuel wants to merge 0 commit intohuggingface:masterfrom
Closed
[WIP] Add patience argument to run_language_modeling script#2840thesamuel wants to merge 0 commit intohuggingface:masterfrom
thesamuel wants to merge 0 commit intohuggingface:masterfrom
Conversation
Author
|
Sounds great! I'll go ahead and fix the code quality check. |
8cc8568 to
a5989b0
Compare
b51db35 to
877fc56
Compare
Author
|
Since |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Often, we want to stop training if loss does not improve for a number of epochs. This PR adds a "patience" argument, which is a limit on the number of times we can get a non-improving eval loss before stopping training early.
It is implemented by other NLP frameworks, such as AllenNLP (see trainer.py and metric_tracker.py).
Motivation
This feature allows faster fine-tuning by breaking the training loop early and avoids users the toil of checking metrics on Tensorboard.
Caveats
Often, models are evaluated once per epoch, but run_lm_finetuning.py has an option to evaluate after a set number of model update steps (dictated by
--logging_stepsif--evaluate_during_trainingis true). Because of this, I've elected to tie patience to the number of evaluations without improvement in loss.To-do