-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Internal uses of torch.cuda.amp.autocast
raise FutureWarnings
#130659
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
Comments
cc @guangyey could you please help fix this? |
|
Fixes #130659 Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com> Pull Request resolved: #130660 Approved by: https://github.com/guangyey, https://github.com/fegin, https://github.com/albanD
Fixes pytorch#130659 Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com> Pull Request resolved: pytorch#130660 Approved by: https://github.com/guangyey, https://github.com/fegin, https://github.com/albanD
Fixes pytorch#130659 Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com> Pull Request resolved: pytorch#130660 Approved by: https://github.com/guangyey, https://github.com/fegin, https://github.com/albanD
Also found a usage of What's worse, the warning for this line produces everytime during |
@function2-llx I see this fix targets release 2.4.1, please refer to [this comment].(#128436 (comment)) |
Fixes #130659 Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com> Pull Request resolved: #130660 Approved by: https://github.com/guangyey, https://github.com/fegin, https://github.com/albanD (cherry picked from commit bb62e9d)
Fixes pytorch#130659 Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com> Pull Request resolved: pytorch#130660 Approved by: https://github.com/guangyey, https://github.com/fegin, https://github.com/albanD
Fixes #130659 Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com> Pull Request resolved: #130660 Approved by: https://github.com/guangyey, https://github.com/fegin, https://github.com/albanD Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
You can downgrade to torch==2.3.1 and torchvision==0.18.1, warning stops coming |
@function2-llx, you can try the way @naga24 mentioned or get the fix in the upcoming 2.4.1 release. |
Thanks for the suggestions! |
Also found in engine.py, line 30. This FutureWarning appears on the tutorial website TorchVision Object Detection Finetuning Tutorial. Also mentioned in pytorch/tutorials#3007. |
Validated with torch==2.4.1 RC. FYI the original repro modified to run on a single GPU machine:
|
Hello, there. I check the model dtype then use 「with torch.autocast("cuda", torch.float32):」 instead 「with torch.cuda.amp.autocast(autocast):」 it works and no Future Warning, FYI. p.s.torch.version == 2.4.1 , yolov5 model |
Uh oh!
There was an error while loading. Please reload this page.
🐛 Describe the bug
PyTorch 2.4 deprecated the use of
torch.cuda.amp.autocast
in favor oftorch.amp.autocast("cuda", ...)
, but this change has missed updating internal uses in PyTorch. For example in DP here:pytorch/torch/nn/parallel/parallel_apply.py
Lines 92 to 93 in 3710a79
Produces:
Since these are caused internally, the user will see the warning but not be able to do anything with it.
If desired, I can send a PR with a fix for this :)
Versions
PyTorch version: 2.4.0+cu121
cc @mcarilli @ptrblck @leslie-fang-intel @jgong5
The text was updated successfully, but these errors were encountered: