Skip to content

Commit

Permalink
[gym/rllib] Update checkpoint_dir so it is dependant on iteration num…
Browse files Browse the repository at this point in the history
…ber (#789)
  • Loading branch information
mwulfman authored May 8, 2024
1 parent 546b169 commit 66113be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/gym_jiminy/rllib/gym_jiminy/rllib/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ def train(algo: Algorithm,

# Backup the policy
if checkpoint_period > 0 and iter_num % checkpoint_period == 0:
algo.save(checkpoint_dir=algo.logdir)
algo.save(
checkpoint_dir=f"{algo.logdir}/checkpoint_{iter_num :06d}")

# Check terminal conditions
if 0 < max_timesteps < result["timesteps_total"]:
Expand All @@ -516,7 +517,8 @@ def train(algo: Algorithm,
result_logger.close()

# Backup trained agent and return file location
return algo.save(checkpoint_dir=algo.logdir)
return algo.save(
checkpoint_dir=f"{algo.logdir}/checkpoint_{iter_num :06d}")


def _restore_default_connectors() -> None:
Expand Down

0 comments on commit 66113be

Please sign in to comment.