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

Error in logging of Regression Metrics #4266

Closed
pbmstrk opened this issue Oct 20, 2020 · 5 comments · Fixed by #4313
Closed

Error in logging of Regression Metrics #4266

pbmstrk opened this issue Oct 20, 2020 · 5 comments · Fixed by #4313
Assignees
Labels
bug Something isn't working help wanted Open to be worked on
Milestone

Comments

@pbmstrk
Copy link
Contributor

pbmstrk commented Oct 20, 2020

🐛 Bug

When attempting to log a regression metric object as described here when training for more than one epoch, the following error occurs,

RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment

Interestingly, this error only occurs when using regression metrics. For example, Accuracy() works without any problems.

Boring Model Link

Link

Expected behavior

Logging should work for all metrics.

When comparing to metrics that work it seems that in the case of the regression metrics some of the variables (e.g. sum_squared_error) are still attached to the computational graph - which seems to be the cause of the problem. If I add the line,

preds = preds.detach()

to the update() method everything seems to work.

Environment

see colab.

@pbmstrk pbmstrk added bug Something isn't working help wanted Open to be worked on labels Oct 20, 2020
@edenlightning
Copy link
Contributor

@SkafteNicki or @teddykoker

@edenlightning edenlightning added this to the 1.0.x milestone Oct 22, 2020
@ananyahjha93
Copy link
Contributor

@pbmstrk mind sending in a PR with .detach fix?

@ananyahjha93
Copy link
Contributor

@pbmstrk actually there are other issues with detaching or keeping attached metrics which are discussed here, so maybe wait for @SkafteNicki to send in a PR for the base class and see if that resolves the issue itself.

Discussion here: #4098.

@pbmstrk
Copy link
Contributor Author

pbmstrk commented Oct 22, 2020

@ananyahjha93 Ah okay, no worries!

@SkafteNicki
Copy link
Member

@pbmstrk just pushed a commit to PR #4313 that solves the bug (confirmed by running colab model) :]
Basically had to call detach within the self.log code (only Metric objects did not automatically get detached, which is rectified now in the PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants