From f063c95d52f5d89cadbe182641955af88f966edb Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Thu, 26 Oct 2023 11:24:55 +0200 Subject: [PATCH] Apply datetime_tag() in high-level examples --- examples/atari/atari_ppo_hl.py | 5 ++--- examples/mujoco/mujoco_sac_hl.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/atari/atari_ppo_hl.py b/examples/atari/atari_ppo_hl.py index d388d6bc4..0a05b3f54 100644 --- a/examples/atari/atari_ppo_hl.py +++ b/examples/atari/atari_ppo_hl.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import datetime import os from collections.abc import Sequence @@ -20,6 +19,7 @@ PolicyWrapperFactoryIntrinsicCuriosity, ) from tianshou.utils import logging +from tianshou.utils.logging import datetime_tag def main( @@ -54,8 +54,7 @@ def main( icm_reward_scale: float = 0.01, icm_forward_loss_weight: float = 0.2, ): - now = datetime.datetime.now().strftime("%y%m%d-%H%M%S") - log_name = os.path.join(task, "ppo", str(experiment_config.seed), now) + log_name = os.path.join(task, "ppo", str(experiment_config.seed), datetime_tag()) sampling_config = SamplingConfig( num_epochs=epoch, diff --git a/examples/mujoco/mujoco_sac_hl.py b/examples/mujoco/mujoco_sac_hl.py index e94b8abba..95fa8e7d0 100644 --- a/examples/mujoco/mujoco_sac_hl.py +++ b/examples/mujoco/mujoco_sac_hl.py @@ -13,6 +13,7 @@ from tianshou.highlevel.params.alpha import AutoAlphaFactoryDefault from tianshou.highlevel.params.policy_params import SACParams from tianshou.utils import logging +from tianshou.utils.logging import datetime_tag def main( @@ -37,8 +38,7 @@ def main( training_num: int = 1, test_num: int = 10, ): - now = datetime.datetime.now().strftime("%y%m%d-%H%M%S") - log_name = os.path.join(task, "sac", str(experiment_config.seed), now) + log_name = os.path.join(task, "sac", str(experiment_config.seed), datetime_tag()) sampling_config = SamplingConfig( num_epochs=epoch,