From 595b4bda07f51c64b39082dbfdec186b2419baae Mon Sep 17 00:00:00 2001 From: thatguy11325 <148832074+thatguy11325@users.noreply.github.com> Date: Sat, 26 Oct 2024 00:19:19 -0400 Subject: [PATCH] delay deletion --- pokemonred_puffer/cleanrl_puffer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pokemonred_puffer/cleanrl_puffer.py b/pokemonred_puffer/cleanrl_puffer.py index 086cca9..9d15e69 100644 --- a/pokemonred_puffer/cleanrl_puffer.py +++ b/pokemonred_puffer/cleanrl_puffer.py @@ -320,13 +320,17 @@ def evaluate(self): new_state = random.choice(self.states[new_state_key]) """ if self.config.train.early_stop: + to_delete = [] for event, minutes in self.config.train.early_stop.values(): if any(event in key for key in self.state.keys()): - del self.config.train.early_stop[event] + to_delete.append(event) elif self.profile.uptime > minutes * 60 and all( event not in key for key in self.states.keys() ): self.early_stop = True + break + for event in to_delete: + del self.config.train.early_stop[event] # V2 implementation # check if we have a new highest required_count with N save states available