This commit is contained in:
Dobromir Popov 2025-02-02 00:57:12 +02:00
parent f7f10bc17c
commit f8c1d95a25

View File

@ -75,7 +75,8 @@ def get_best_models(directory):
def save_checkpoint(model, epoch, reward, last_dir=LAST_DIR, best_dir=BEST_DIR):
"""Save the model state always to the last_dir and conditionally to best_dir if reward is high enough."""
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
last_filename = f"model_last_epoch_{epoch}_{timestamp}.pt"
# last_filename = f"model_last_epoch_{epoch}_{timestamp}.pt"
last_filename = f"model_last_epoch_{epoch}.pt"
last_path = os.path.join(last_dir, last_filename)
torch.save({
"epoch": epoch,