Skip to content

Commit

Permalink
Better fix for PR #405, fix patience check when swa is not active
Browse files Browse the repository at this point in the history
  • Loading branch information
bernstei committed May 6, 2024
1 parent a9681fe commit bb10932
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mace/tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ def train(

if valid_loss >= lowest_loss:
patience_counter += 1
if patience_counter >= patience and (swa.start is not None and epoch < swa.start):
if patience_counter >= patience and (swa is not None and epoch < swa.start):
logging.info(
f"Stopping optimization after {patience_counter} epochs without improvement and starting swa"
)
epoch = swa.start
elif patience_counter >= patience and (swa.start is None or epoch >= swa.start):
elif patience_counter >= patience and (swa is None or epoch >= swa.start):
logging.info(
f"Stopping optimization after {patience_counter} epochs without improvement"
)
Expand Down

0 comments on commit bb10932

Please sign in to comment.