Skip to content

Commit

Permalink
user warnings for nan loss cases instead of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gcroci2 committed Dec 20, 2023
1 parent 992bc48 commit 50bbe82
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deeprank2/trainer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import logging
import warnings
from time import time
from typing import List, Optional, Tuple, Union

Expand Down Expand Up @@ -638,8 +639,8 @@ def train( # pylint: disable=too-many-arguments, too-many-branches, too-many-loc
self.epoch_saved_model = epoch
_log.info(f'Last model saved at epoch # {self.epoch_saved_model}.')
if not saved_model:
_log.warning("A model has been saved but the validation and/or the training losses were NaN;" +
"try to increase the cutoff distance during the data processing or the number of data points" +
warnings.warn("A model has been saved but the validation and/or the training losses were NaN;" +
"\n\ttry to increase the cutoff distance during the data processing or the number of data points " +
"during the training.")

# Now that the training loop is over, save the model
Expand Down

0 comments on commit 50bbe82

Please sign in to comment.