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

Remove on epoch guard from the should stop validation check #7701

Merged
merged 2 commits into from
May 25, 2021

Conversation

carmocca
Copy link
Contributor

What does this PR do?

Remove if on_epoch when deciding whether to run validation if should_stop=True.
Add a test.

The behavior is the same in both cases because even when should_stop=True and _should_check_val_fx() returns False mid-epoch, when it gets called again out of the batch-loop, it returns True.

Part of #7357

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • [n/a] Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #7701 (f4b305c) into master (e2ead9a) will decrease coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #7701   +/-   ##
======================================
- Coverage      93%     92%   -0%     
======================================
  Files         199     199           
  Lines       12965   12960    -5     
======================================
- Hits        11995   11952   -43     
- Misses        970    1008   +38     

@awaelchli
Copy link
Contributor

awaelchli commented May 25, 2021

Can you include the refactors in the changelog, including #7682 ? I have a section "Refactored Loops"


assert trainer.current_epoch == 0
assert trainer.global_step == 5
assert model.validation_called_at == (0, 4) # TODO(@carmocca): should be 5 - will be fixed in next PR
Copy link
Contributor

Choose a reason for hiding this comment

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

why 5, in the current way global step is used it is expected.
what are you planning to fix here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, but the current way is "wrong" (although expected given the design in master). That's why I used the verb "fix"

The fix will be incrementing the global_step count appropriately

Copy link
Contributor

Choose a reason for hiding this comment

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

But we said we would use the progress tracking to count optimizer step?
The only difference between global_step and the real optimizer step count is that the global_step update is delayed for logging.
Sorry if I mix something up again here.

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@carmocca carmocca merged commit 3e5d6e9 into master May 25, 2021
@carmocca carmocca deleted the refactor/training-loop-should-stop branch May 25, 2021 15:16
carmocca added a commit that referenced this pull request May 25, 2021
* Remove on epoch guard from the should stop validation check

* Formatting
carmocca added a commit that referenced this pull request May 25, 2021
* Remove on epoch guard from the should stop validation check

* Formatting
carmocca added a commit that referenced this pull request May 25, 2021
* Remove on epoch guard from the should stop validation check

* Formatting
awaelchli added a commit that referenced this pull request May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants