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

Some metrics don't work on CPU using float16 #57

Closed
Llannelongue opened this issue Dec 31, 2020 · 6 comments
Closed

Some metrics don't work on CPU using float16 #57

Llannelongue opened this issue Dec 31, 2020 · 6 comments
Assignees
Labels
bug / fix Something isn't working help wanted Extra attention is needed
Milestone

Comments

@Llannelongue
Copy link

🐛 Bug

It looks like some metrics such as Precision-Recall curve don't work on CPUs when using float16, perhaps due to a missing feature in pytorch?

Please reproduce using the BoringModel

https://colab.research.google.com/drive/1xDv043rRi5WBshP4m5aoxTt2ChlfxjIk?usp=sharing

Expected behavior

the metrics should work in half precision on CPUs as well.

Environment

  • CUDA:
    • GPU:
      • Tesla T4
    • available: True
    • version: 10.1
  • Packages:
    • numpy: 1.19.4
    • pyTorch_debug: True
    • pyTorch_version: 1.7.0+cu101
    • pytorch-lightning: 1.1.2
    • tqdm: 4.41.1
  • System:
@Borda
Copy link
Member

Borda commented Dec 31, 2020

@SkafteNicki mind have look? :]

@SkafteNicki
Copy link
Member

Definitely an lack of support from pytorch side, but seems to be on track to be solved:
Issue: pytorch/pytorch#49889
PR with fix: pytorch/pytorch#49895
I can try to see if the code can be rewritten with operations that support float16
Probably should also add test for float16 in general for metrics.

@SkafteNicki
Copy link
Member

Just a follow up: the following metrics does not work with float16 CPU because of lack of support from a list of pytorch operations (in parentheses)

  • SSIM (torch.arange)
  • PSNR (torch.pow)
  • MeanSquaredLogError (torch.logp1 & torch.pow)
  • MeanSquaredError (torch.pow)
  • ExplainedVariance (torch.pow)
  • PrecisionRecallCurve (torch.flip)
  • AveragePrecision (torch.flip)
    @Borda how to move forward with this? I think some of these can be converted in operations that support float16 CPU (pow can be made to multiplication) but I am not sure about all of them

@edenlightning
Copy link
Contributor

@Borda

@Borda Borda transferred this issue from Lightning-AI/pytorch-lightning Mar 12, 2021
@github-actions
Copy link

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

@Borda Borda added bug / fix Something isn't working help wanted Extra attention is needed labels Mar 17, 2021
@Borda Borda added this to the 0.3 milestone Mar 25, 2021
@edenlightning
Copy link
Contributor

looks like this was fixed in pytorch/pytorch@5d93e2b

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

No branches or pull requests

5 participants