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

Avoid adding None loss values in training_epoch_end #7772

Merged
merged 7 commits into from
May 31, 2021

Conversation

carmocca
Copy link
Contributor

What does this PR do?

In manual optimization, users are not forced to return a loss in their training_step.
However, this meant that a None loss was getting added in training_epoch_end.

Also reduced code duplication in the tests.

Part of #7631

Even though this is a bug-fix, it doesn't need to go into 1.3.x as no user reported this.

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?
  • 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

@carmocca carmocca added the bug Something isn't working label May 31, 2021
@carmocca carmocca added this to the v1.4 milestone May 31, 2021
@carmocca carmocca self-assigned this May 31, 2021
@codecov
Copy link

codecov bot commented May 31, 2021

Codecov Report

Merging #7772 (a2fa7c0) into master (a69beab) will decrease coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #7772   +/-   ##
======================================
- Coverage      92%     92%   -0%     
======================================
  Files         199     199           
  Lines       12986   12987    +1     
======================================
- Hits        11994   11982   -12     
- Misses        992    1005   +13     

@carmocca carmocca changed the title Avoid adding None loss keys on train epoch end Avoid adding None loss values in training_epoch_end May 31, 2021
CHANGELOG.md Outdated Show resolved Hide resolved
@justusschock justusschock enabled auto-merge (squash) May 31, 2021 08:08
@carmocca carmocca disabled auto-merge May 31, 2021 11:26
@carmocca carmocca enabled auto-merge (squash) May 31, 2021 12:02
@carmocca carmocca added the ready PRs ready to be merged label May 31, 2021
@carmocca carmocca merged commit 0dd6d3a into master May 31, 2021
@carmocca carmocca deleted the bugfix/extra-loss-key-manual branch May 31, 2021 19:28
awaelchli added a commit that referenced this pull request May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants