Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add early stopping #767

Merged
merged 2 commits into from
May 16, 2023
Merged

Add early stopping #767

merged 2 commits into from
May 16, 2023

Conversation

aakashdp6548
Copy link
Collaborator

Add option to stop training early if validation loss hasn't decreased for a set number of epochs. This is configurable using the enable_early_stopping and patience flags in config.trainer.

I removed the min_epochs flag from trainer because that overrides early stopping. I also suppressed a pylint warning for too-many-statements in train - we should maybe consider factoring some of the stuff that isn't directly related to training, like loading best weights, into a separate function.

@aakashdp6548 aakashdp6548 linked an issue May 16, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Merging #767 (b420fc5) into master (760e909) will increase coverage by 0.15%.
The diff coverage is 96.87%.

@@            Coverage Diff             @@
##           master     #767      +/-   ##
==========================================
+ Coverage   88.75%   88.90%   +0.15%     
==========================================
  Files          14       14              
  Lines        1254     1271      +17     
==========================================
+ Hits         1113     1130      +17     
  Misses        141      141              
Flag Coverage Δ
unittests 88.90% <96.87%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
bliss/simulator/simulated_dataset.py 88.88% <91.66%> (-0.59%) ⬇️
bliss/generate.py 98.57% <100.00%> (+0.04%) ⬆️
bliss/train.py 68.00% <100.00%> (+5.07%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@zhixiangteoh zhixiangteoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! If it's straightforward to add a test for early stopping, that'd be great

bliss/train.py Show resolved Hide resolved
bliss/train.py Show resolved Hide resolved
conf/base_config.yaml Show resolved Hide resolved
Copy link
Contributor

@jeff-regier jeff-regier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@zhixiangteoh zhixiangteoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@aakashdp6548 aakashdp6548 merged commit b9df236 into master May 16, 2023
@aakashdp6548 aakashdp6548 deleted the 766-add-early-stopping-to-trainer branch May 16, 2023 17:45
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.

Add early stopping to trainer
3 participants