-
Notifications
You must be signed in to change notification settings - Fork 453
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
[PyTorch] replace no_grad with inference_mode #1323
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1323 +/- ##
==========================================
+ Coverage 95.75% 95.76% +0.01%
==========================================
Files 154 154
Lines 6902 6902
==========================================
+ Hits 6609 6610 +1
+ Misses 293 292 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the modification be made for the evaluate
function in references/classification/train_pytorch.py
? Same question for the others train_pytorch.py
?
No because in the training scripts we switch between train mode and eval mode this works with no_grad but if the model/pipe is once in inference mode we cannot switch back into train mode but that's fine for inference :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks @felixdittrich92 !
This PR:
no_grad
toinference_mode
(ref.: https://pytorch.org/docs/stable/generated/torch.inference_mode.html)