Skip to content

Commit

Permalink
solved bug when f is not in target
Browse files Browse the repository at this point in the history
  • Loading branch information
BowenD-UCB committed Aug 1, 2024
1 parent b663e80 commit 6628600
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chgnet/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ def save_checkpoint(self, epoch: int, mae_error: dict, save_dir: str) -> None:
filename,
os.path.join(save_dir, f"bestE_epoch{epoch}_{err_str}.pth.tar"),
)
if mae_error["f"] == min(self.training_history["f"]["val"]):
if "f" in self.targets and mae_error["f"] == min(
self.training_history["f"]["val"]
):
for fname in os.listdir(save_dir):
if fname.startswith("bestF"):
os.remove(os.path.join(save_dir, fname))
Expand Down

0 comments on commit 6628600

Please sign in to comment.