From 4ac714c151e500c1d2453ea7dccb0515a38e84b7 Mon Sep 17 00:00:00 2001 From: VedantDave Date: Mon, 22 May 2023 14:26:37 +0200 Subject: [PATCH] Adding logger --- logger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/logger.py b/logger.py index 8e31fd4..54c1142 100644 --- a/logger.py +++ b/logger.py @@ -7,6 +7,7 @@ import torch import torchvision import numpy as np from termcolor import colored +from datetime import datetime FORMAT_CONFIG = { 'rl': { @@ -93,8 +94,10 @@ class MetersGroup(object): class Logger(object): def __init__(self, log_dir, use_tb=True, config='rl'): self._log_dir = log_dir + now = datetime.now() + dt_string = now.strftime("%d_%m_%Y-%H_%M_%S") if use_tb: - tb_dir = os.path.join(log_dir, 'tb') + tb_dir = os.path.join(log_dir, 'runs/tb_'+dt_string) if os.path.exists(tb_dir): shutil.rmtree(tb_dir) self._sw = SummaryWriter(tb_dir) @@ -160,4 +163,4 @@ class Logger(object): def dump(self, step): self._train_mg.dump(step, 'train') - self._eval_mg.dump(step, 'eval') + self._eval_mg.dump(step, 'eval') \ No newline at end of file