Skip to content
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

Refactored 'predict' function for BB torch models. #784

Merged

Conversation

RobertSamoilescu
Copy link
Collaborator

The refactoring ensures that the gradients are not computes and the model is in evaluation mode for torch models.

In the previous version, the detach function was used. This means that the gradients were computed, but detached afterwards. Note that there is no need to compute the gradients at all as it adds extra computation complexity and memory consumption especially for large models. Furthermore we should try to emphasize the model should be in eval mode.

Copy link
Contributor

@jklaise jklaise left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@RobertSamoilescu RobertSamoilescu force-pushed the fix/prediction-function-torch branch from 126c346 to c5a289f Compare September 23, 2022 14:29
@codecov
Copy link

codecov bot commented Sep 23, 2022

Codecov Report

Merging #784 (126c346) into master (70d5bb1) will not change coverage.
The diff coverage is n/a.

❗ Current head 126c346 differs from pull request most recent head c5a289f. Consider uploading reports for the commit c5a289f to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #784   +/-   ##
=======================================
  Coverage   75.72%   75.72%           
=======================================
  Files          72       72           
  Lines        8223     8223           
=======================================
  Hits         6227     6227           
  Misses       1996     1996           
Flag Coverage Δ
macos-latest-3.10.6 ?
ubuntu-latest-3.10.6 75.70% <ø> (+0.09%) ⬆️
ubuntu-latest-3.7 75.43% <ø> (-0.10%) ⬇️
ubuntu-latest-3.8 75.57% <ø> (+0.09%) ⬆️
ubuntu-latest-3.9 75.48% <ø> (-0.10%) ⬇️
windows-latest-3.9 73.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@jklaise jklaise merged commit 5a9b2ac into SeldonIO:master Sep 23, 2022
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