-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix: no_grad
with AMP bug
#20921
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
Fix: no_grad
with AMP bug
#20921
Conversation
08508b6
to
d18fb08
Compare
Then se shall report it and offer a fix in BTW, have you measured the performance drop? |
@Borda it is a long-standing issue in But I agree with you that it should be fixed in I haven't measured the performance drop since it will vary strongly across architectures and probably also hardware setups. |
@baskrahmer lets link the Torch issue also here for visibility 🐰 |
Co-authored-by: Jirka Borovec <[email protected]>
Sure, there's pytorch/pytorch#65766, pytorch/pytorch#112583 and pytorch/pytorch#105211 |
* Disable cache for torch.autocast in amp * Add a test * Only test for bf16-mixed * Implement test to reproduce the issue --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit 216f9ec)
* Disable cache for torch.autocast in amp * Add a test * Only test for bf16-mixed * Implement test to reproduce the issue --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit 216f9ec)
Fixes #20644
Note however that this would affect performance for other users, so the question is whether it is worth optimizing for this edge case that is fundamentally a
torch
bug.cc @Borda
📚 Documentation preview 📚: https://pytorch-lightning--20921.org.readthedocs.build/en/20921/