Skip to content

Commit

Permalink
Add timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
1pha committed Jan 19, 2024
1 parent 6d92ff8 commit 0d449d1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sage/trainer/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Includes model inference, output sorting utils
"""
from datetime import datetime
from pathlib import Path
import pickle

Expand Down Expand Up @@ -69,6 +70,12 @@ def _sort_outputs(outputs):
return result


def timestamp(fmt: str = "%y%m%d_%H%M") -> str:
now = datetime.now()
now = now.strftime(fmt)
return now


def finalize_inference(prediction: list,
name: str,
root_dir: Path = Path(".")) -> None:
Expand All @@ -89,7 +96,7 @@ def finalize_inference(prediction: list,
pickle.dump(prediction, f)

# 2. Log Predictions
run_name = save_name[:-4]
run_name = save_name[:-4] + "_" + timestamp()
preds, target = prediction["pred"], prediction["target"]
if name.startswith("C"):
logger.info("Classification data given:")
Expand Down

0 comments on commit 0d449d1

Please sign in to comment.