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

PearsonCorrcoef Causing OOM #373

Closed
Divide-By-0 opened this issue Jul 14, 2021 · 1 comment · Fixed by #380
Closed

PearsonCorrcoef Causing OOM #373

Divide-By-0 opened this issue Jul 14, 2021 · 1 comment · Fixed by #380
Labels
bug / fix Something isn't working help wanted Extra attention is needed
Milestone

Comments

@Divide-By-0
Copy link

🐛 Bug

When using torchmetrics.PearsonCorrcoef as a validation metric, I get
UserWarning: Metric PearsonCorrcoef will save all targets and predictions in buffer. For large datasets this may lead to large memory footprint.

To Reproduce

Steps to reproduce the behavior:

  1. Use torchmetrics.PearsonCorrcoef as a validation_metric in any existing model.

Code sample

  1. Use torchmetrics.PearsonCorrcoef as a validation_metric in any existing model.

Expected behavior

An iterative batch-by-batch algorithm is implemented for Pearson R calculation so memory is not maintained long-term.

For example, stack overflow suggests this (unverified algorithm) https://stackoverflow.com/a/65132700 and one would expect that Keras/other Pytorch alternatives possibly have an internal accumulative algorithm.

Environment

  • PyTorch Version (e.g., 1.0): 1.9
  • OS (e.g., Linux): Linux
  • How you installed PyTorch (conda, pip, source): conda
  • Build command you used (if compiling from source):
  • Python version: 3.8
  • CUDA/cuDNN version: 11.1
  • GPU models and configuration: 2080Ti (7GB RAM)
  • Any other relevant information:

Additional context

@Divide-By-0 Divide-By-0 added bug / fix Something isn't working help wanted Extra attention is needed labels Jul 14, 2021
@github-actions
Copy link

Hi! thanks for your contribution!, great first issue!

@Borda Borda changed the title Fix for PearsonCorrcoef Causing OOM PearsonCorrcoef Causing OOM Jul 14, 2021
@Borda Borda added this to the v0.5 milestone Aug 18, 2021
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 help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants