Skip to content

Commit b641def

Browse files
authored
Add timestamp to stored model checkpoints (#502)
1 parent fb8495b commit b641def

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

torch_em/trainer/default_trainer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import warnings
77
import contextlib
88
from tqdm import tqdm
9-
from collections import OrderedDict
109
from functools import partial
10+
from datetime import datetime
11+
from collections import OrderedDict
1112
from importlib import import_module
1213
from typing import Any, Callable, Dict, Optional, Union, Literal
1314

@@ -584,6 +585,7 @@ def save_checkpoint(self, name, current_metric, best_metric, train_time=0.0, **e
584585
"optimizer_state": self.optimizer.state_dict(),
585586
"init": self.init_data | extra_init_dict,
586587
"train_time": train_time,
588+
"timestamp": datetime.now().strftime("%d-%m-%Y (%H:%M:%S)"),
587589
}
588590
save_dict.update(**extra_save_dict)
589591
if self.scaler is not None:

0 commit comments

Comments
 (0)