Skip to content

Commit

Permalink
Only call .eval if training
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyballentine committed May 17, 2024
1 parent 65ebd7e commit f6e6510
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/spandrel/spandrel/__helpers/model_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ def __call__(self, image: Tensor) -> Tensor:
did_pad, image = pad_tensor(image, self.size_requirements)

# Optimize for inference
self.model.eval()
if self.model.training:
self.model.eval()

# call model
output = self._call_fn(self.model, image)
Expand Down

0 comments on commit f6e6510

Please sign in to comment.