diff --git a/rlgym_ppo/learner.py b/rlgym_ppo/learner.py index c89e971..09bcb30 100644 --- a/rlgym_ppo/learner.py +++ b/rlgym_ppo/learner.py @@ -327,6 +327,12 @@ def _learn(self): self.epoch += 1 + # save checkpoint if timestep limit is hit + else: + if self.agent.cumulative_timesteps >= self.timestep_limit: + print(f"Timestep limit of {self.timestep_limit} reached, saving checkpoint...") + self.save(self.agent.cumulative_timesteps) + @torch.no_grad() def add_new_experience(self, experience): """