You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our knn and linear classifiers used for benchmarking do not set the model to evaluation mode before training. Instead we only set requires gradients to False, see:
The correct way to do this would be to set the model to eval mode before every training epoch:
def on_train_epoch_start(self) -> None:
if self.freeze_model:
self.model.eval()
Note that it has to happen in on_train_epoch_start because pytorch lightning automatically sets models to train mode at the beginning of the training epoch.
This was already implemented in #1263 but the PR is not yet merged to the main branch (and probably won't be merged for a while).
The text was updated successfully, but these errors were encountered:
Our knn and linear classifiers used for benchmarking do not set the model to evaluation mode before training. Instead we only set requires gradients to False, see:
lightly/lightly/utils/benchmarking/knn_classifier.py
Lines 144 to 150 in 54a1b7b
The correct way to do this would be to set the model to eval mode before every training epoch:
Note that it has to happen in
on_train_epoch_start
because pytorch lightning automatically sets models to train mode at the beginning of the training epoch.This was already implemented in #1263 but the PR is not yet merged to the main branch (and probably won't be merged for a while).
The text was updated successfully, but these errors were encountered: