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

gradient value should be unscaled when precision=16 #9205

Closed
AndersJing opened this issue Aug 30, 2021 · 2 comments · Fixed by #9606
Closed

gradient value should be unscaled when precision=16 #9205

AndersJing opened this issue Aug 30, 2021 · 2 comments · Fixed by #9606
Assignees
Labels
bug Something isn't working priority: 0 High priority task
Milestone

Comments

@AndersJing
Copy link

🐛 Bug

On 1.4.x, when track_grad_norm=2 and precision=16, the logged gradient value is the scaled value.

To Reproduce

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

Expected behavior

The gradient value should be unscaled when preciosn=16

Environment

  • CUDA:
    • GPU:
      • Tesla K80
    • available: True
    • version: 10.2
  • Packages:
    • numpy: 1.19.5
    • pyTorch_debug: False
    • pyTorch_version: 1.9.0+cu102
    • pytorch-lightning: 1.4.4
    • tqdm: 4.62.0
  • System:
    • OS: Linux
    • architecture:
      • 64bit
    • processor: x86_64
    • python: 3.7.11
    • version: Sat Jun 5 09:50:34 PDT 2021

Additional context

On v1.3.8, the behavior is normal, see https://colab.research.google.com/drive/1AXMhr1gPll5ZPDTphQqAOJlI_9iEMISU?usp=sharing

@carmocca

@AndersJing AndersJing added bug Something isn't working help wanted Open to be worked on labels Aug 30, 2021
@carmocca carmocca added priority: 0 High priority task and removed help wanted Open to be worked on labels Aug 30, 2021
@carmocca carmocca self-assigned this Aug 30, 2021
@carmocca carmocca added this to the v1.4.x milestone Aug 30, 2021
@awaelchli awaelchli changed the title gradient value should be unscaled when preciosn=16 on v1.4.x gradient value should be unscaled when precision=16 Aug 31, 2021
@cowwoc
Copy link
Contributor

cowwoc commented Oct 3, 2021

I believe this is fixed in release 1.4.9: https://github.com/PyTorchLightning/pytorch-lightning/releases/tag/1.4.9

Can this issue be closed?

@AndersJing
Copy link
Author

I run the code again on 1.4.9, the issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: 0 High priority task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants