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

Investigate potential memory bug #902

Merged
merged 16 commits into from
Mar 23, 2022
Merged

Investigate potential memory bug #902

merged 16 commits into from
Mar 23, 2022

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Mar 22, 2022

What does this PR do?

Fixes #890
We have a memory leak in metric.update as the current code does not disable gradients, meaning that if users pass input with requires_grad=True to metric.update we will accumulate gradient information over time which is not wanted (will lead to memory errors). We have already disabled this for the global accumulation that is done during forward and this PR just extends to also be during direct calls to update.
We will still allow gradient information to pass through for the batch computation in forward.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Mar 22, 2022

Codecov Report

Merging #902 (b040278) into master (5141040) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #902   +/-   ##
=====================================
  Coverage      95%    95%           
=====================================
  Files         173    173           
  Lines        7254   7257    +3     
=====================================
+ Hits         6868   6898   +30     
+ Misses        386    359   -27     

@Borda Borda added this to the v0.7 milestone Mar 23, 2022
@Borda
Copy link
Member

Borda commented Mar 23, 2022

fixed the missing package in tests :)

requirements/test.txt Outdated Show resolved Hide resolved
@SkafteNicki SkafteNicki changed the title [WIP] Investigate potential memory bug Investigate potential memory bug Mar 23, 2022
@Borda Borda requested review from justusschock, Borda and a team March 23, 2022 10:50
@mergify mergify bot added the ready label Mar 23, 2022
@Borda Borda enabled auto-merge (squash) March 23, 2022 11:47
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 !

@Borda Borda disabled auto-merge March 23, 2022 15:52
@Borda Borda merged commit 8c052e7 into master Mar 23, 2022
@Borda Borda deleted the bugfix/memory_issue branch March 23, 2022 15:53
Borda pushed a commit that referenced this pull request Mar 23, 2022
* test psutil
* fix skipping
* fix test
* remove no_grad
* memory

Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

(cherry picked from commit 8c052e7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inefficient memory consumption by MeanMetric
5 participants