Skip to content

Commit

Permalink
Apply datetime_tag() in high-level examples
Browse files Browse the repository at this point in the history
  • Loading branch information
opcode81 committed Oct 26, 2023
1 parent 8d36e66 commit f063c95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions examples/atari/atari_ppo_hl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python3

import datetime
import os
from collections.abc import Sequence

Expand All @@ -20,6 +19,7 @@
PolicyWrapperFactoryIntrinsicCuriosity,
)
from tianshou.utils import logging
from tianshou.utils.logging import datetime_tag


def main(
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions examples/mujoco/mujoco_sac_hl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit f063c95

Please sign in to comment.