-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[bugfix] Changed CometLogger to stop modifying metrics in place #9150
[bugfix] Changed CometLogger to stop modifying metrics in place #9150
Conversation
…ore calling val.cpu().detach()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sohamtiwari3120 looking pretty good!
would you mind adding a changelog entry too in the file CHANGELOG.md?
Codecov Report
@@ Coverage Diff @@
## master #9150 +/- ##
=======================================
- Coverage 92% 88% -4%
=======================================
Files 176 176
Lines 14870 14825 -45
=======================================
- Hits 13719 13059 -660
- Misses 1151 1766 +615 |
Hi @awaelchli! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the test is added!
Hi @akihironitta I modified the log_metrics function. So should I test whether the metrics dictionary is changing or not? Or you're talking about some other test. Thanks! |
So you want to test that metrics are no longer changed inplace when we call metrics=dict(mymetric=Mock())
logger.log_metrics(metrics)
metrics["mymetric"].cpu.assert_not_called() This would go into the file |
Head branch was pushed to by a user without write access
…tps://github.com/sohamtiwari3120/pytorch-lightning into bug/7021_comet_logger_modifying_metrics_in_place
Hi @awaelchli @tchaton Sincerely, |
looks pretty good! fingers crossed it passes :) |
@awaelchli it seems that the test I added worked finally! 😄 |
removed changes for tests from changelog, that should not be mentioned Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Hi! Do I need to make any further changes to the PR for it to auto-merge? Or should I leave it as it is now? Thanks |
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com> Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com> Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
What does this PR do?
modified log_metrics() in comet.py to make a copy of metrics dictionary before calling val.cpu().detach(), hence preventing metrics from being changed in place.
Fixes #7021
Does your PR introduce any breaking changes? If yes, please list them.
None
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃