Fix memory leak#307
Merged
seba-1511 merged 9 commits intolearnables:masterfrom Feb 10, 2022
Merged
Conversation
Member
|
Thanks a lot @kzhang2 -- this looks great (incl. Meta-SGD!). I'll merge and cut a new release as soon as it passes the tests. |
seba-1511
reviewed
Feb 10, 2022
| N_STEPS = 5 | ||
| N_EVAL = 2 | ||
|
|
||
| device = torch.device('cuda:0') |
Member
There was a problem hiding this comment.
GitHub actions don't have cuda. Can we shield this test with: if torch.cuda.is_available(): so it doesn't run if the machine doesn't have cuda?
seba-1511
reviewed
Feb 10, 2022
| self.assertTrue(hasattr(p, 'grad')) | ||
| self.assertTrue(p.grad.norm(p=2).item() > 0.0) | ||
|
|
||
| def test_memory_consumption(self): |
Member
|
OK, it took a bit of elbow grease but it seems to work now (I also took the opportunity to rewrite some flaky tests). Thanks for contributing this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #284
Fix memory leak in
maml.pyandmeta-sgd.pyand add tests tomaml_test.pyandmetasgd_test.pyto check for possible future memory leaks. A test involving cloning parameters seems to fail, but my changes have nothing to do with it.If necessary, use the following space to provide context or more details.
Contribution Checklist
If your contribution modifies code in the core library (not docs, tests, or examples), please fill the following checklist.
Optional
If you make major changes to the core library, please run
make alltestsand copy-paste the content ofalltests.txtbelow.