Skip to content

Commit

Permalink
Only call .eval if training (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyballentine authored May 17, 2024
1 parent 65ebd7e commit 144090e
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 144090e

Please sign in to comment.