chaiNNer-org / spandrel

Spandrel gives your project support for various PyTorch architectures meant for AI Super-Resolution, restoration, and inpainting. Based on the model support implemented in chaiNNer.
MIT License
102 stars 7 forks source link

Only call .eval if training #261

Closed joeyballentine closed 1 month ago

joeyballentine commented 1 month ago

Turns out, calling .eval isn't a noop. It takes a very small amount of time to do what it does (under 1ms), but it still does it every time. We can save this op by just checking if the model is in training mode first. If it is, then we can .eval it. If it isn't, we can save this.