Skip to content

Disable gradients in inference mode#80

Merged
reidtatge merged 1 commit intoMPACT-ORG:mainfrom
aartbik:bik
Apr 22, 2025
Merged

Disable gradients in inference mode#80
reidtatge merged 1 commit intoMPACT-ORG:mainfrom
aartbik:bik

Conversation

@aartbik
Copy link
Contributor

@aartbik aartbik commented Apr 17, 2025

No description provided.

@google-cla
Copy link

google-cla bot commented Apr 17, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Member

@reidtatge reidtatge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're just disabling the gradient stuff. Oh, for inference mode. Never mind. Approved.

@aartbik
Copy link
Contributor Author

aartbik commented Apr 17, 2025

You're just disabling the gradient stuff? Any particular reason why?

No, I am disabling gradients only during validation. That's the proper PyTorch setup.

Line 17-28: training, gradients on, model in train mode

Line 31-44: evaluation, gradients off, model in eval mode

@reidtatge
Copy link
Member

reidtatge commented Apr 17, 2025 via email

@aartbik
Copy link
Contributor Author

aartbik commented Apr 22, 2025

It looks like one of you has to commit this....

@reidtatge reidtatge merged commit ca97530 into MPACT-ORG:main Apr 22, 2025
1 of 3 checks passed
@reidtatge
Copy link
Member

reidtatge commented Apr 22, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants