-
Notifications
You must be signed in to change notification settings - Fork 7k
"This overload of nonzero is deprecated" #2154
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
Thanks for opening the issue! I would be surprised that the warning would account for such a large slowdown, but changing the code to use the non-deprecated codepaths sounds good to me. A PR fixing this would be awesome! |
Facing the same issue with torchvision.models.detection.keypointrcnn_resnet50_fpn pretrained network. Processing speed is reduced greatly because of the changes in torch.nn.functional. PyTorch version: 1.5.0 A fix to stop this warning from triggering would really be appreciated. Thanks! |
I runned collect_env.py and get printed output. Now, what should I copy and where should I paste it? |
@sykimm copy and paste on github the output of |
@fmassa I'm new to this but I'm keen on contributing and perhaps being able to fix this issue. Having checked repository and the warning, would simply setting |
@java-abhinav07 yes, it would help, but one would need to verify that it doesn't change the behavior of the code so that old models still give the same result |
@fmassa I'll try it locally and get back |
Managed to remove recompute_scale_factor warning. However, the TAT is still high possibly because I'm still getting the overload of nonzero warning. Will create a PR once that's fixed...
PS: The model performance is still the same, verified on multiple images |
So seems like the overhead is in |
Yes, will fix it asap and send in a PR. Albeit, I did take a quick look and it seems like torch.nonzero has been used at multiple places, having changed the same at a couple of instances the time (for my application) was reduced by 0.5s. |
Fixed by #2705 |
ValueError: All bounding boxes should have positive height and width. Found invaid box [500.728515625, 533.3333129882812, 231.10546875, 255.2083282470703] for target at index 0. |
@java-abhinav07 Thanks for helping to improve the code. Did you already fix the |
🐛 Bug
A change in torch\nn\functional might have change usability of the nonzero function used in fasterrcnn_resnet50_fpn. This produces a warning and slows down processing.
To Reproduce
Steps to reproduce the behavior:
Produces the following message
C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\functional.py:2854: UserWarning: The default behavior for interpolate/upsample with float scale_factor will change in 1.6.0 to align with other frameworks/libraries, and use scale_factor directly, instead of relying on the computed output size. If you wish to keep the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details.
warnings.warn("The default behavior for interpolate/upsample with float scale_factor will change "
..\torch\csrc\utils\python_arg_parser.cpp:756: UserWarning: This overload of nonzero is deprecated:
nonzero(Tensor input, *, Tensor out)
Consider using one of the following signatures instead:
nonzero(Tensor input, *, bool as_tuple)
Expected behavior
The warning is not expected and there is a considerable slowdown compared with previous iterations. I cannot quantify this properly but I have noticed that a task that took +- 5 minutes now takes more than 10.
Environment
Please copy and paste the output from our
environment collection script
(or fill out the checklist below manually).
You can get the script and run it with:
conda
,pip
, source): condaAdditional context
The text was updated successfully, but these errors were encountered: