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

Added logic to support warm-up and all pytorch schedulers #207

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

vdobrev1
Copy link

Currently, the early_stopping.py file only supports the ReduceLROnPlateau scheduler from the pytroch schedulers, as it is the only one that accepts input in its step method. In order to use any of the other pytorch schedulers the step method must be called without input. This push request contains code allowing the rest of the schedulers to be used and adds the option to use a warm-up scheduler.

  • Added logic to check if a provided scheduler is ReduceLROnPlateau in which case the step method is called with the current objective.
  • Added logic to support a tuple of schedulers as input where the first one is treated as a warm-up scheduler and is called a number of times defined by the user, afterwards only the second one is called.
  • Added examples in the docstring of valid scheduler tuples and an example of how to define a warm-up scheduler

Note: The warm-up is implemented using a tuple and not the SequentialLR scheduler from pytorch since it does not work with ReduceLROnPlateau. As before the schedulers must be defined in the main training loop.

@MaxFBurg MaxFBurg self-requested a review March 7, 2024 10:53
@pollytur pollytur self-requested a review March 7, 2024 13:12
Copy link
Collaborator

@pollytur pollytur left a comment

Choose a reason for hiding this comment

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

would need modifications to have more schedulers later but good for now

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 7.69231% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 7.38%. Comparing base (a71eb25) to head (d4f01c7).

Files Patch % Lines
neuralpredictors/training/early_stopping.py 7.69% 19 Missing and 5 partials ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #207   +/-   ##
=====================================
  Coverage   7.38%   7.38%           
=====================================
  Files         58      58           
  Lines       5947    5972   +25     
  Branches    1006    1018   +12     
=====================================
+ Hits         439     441    +2     
- Misses      5478    5496   +18     
- Partials      30      35    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pollytur pollytur merged commit 8620f72 into sinzlab:main Mar 7, 2024
7 checks passed
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.

2 participants