Skip to content

Commit

Permalink
add early finish if the game is complete
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Oct 31, 2024
1 parent 273e654 commit f7e7f8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ train:
EVENT_BEAT_BROCK: 30
EVENT_BEAT_MISTY: 90
EVENT_GOT_HM01: 180
one_epoch: True

wrappers:
empty:
Expand Down
10 changes: 9 additions & 1 deletion pokemonred_puffer/cleanrl_puffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,15 @@ def calculate_loss(self, pg_loss, entropy_loss, v_loss):
self.optimizer.step()

def done_training(self):
return self.early_stop or self.global_step >= self.config.total_timesteps
return (
self.early_stop
or self.global_step >= self.config.total_timesteps
or (
self.config.one_epoch
and self.states
and any("EVENT_BEAT_CHAMPION_RIVAL" in key for key in self.states.keys())
)
)

def __enter__(self):
return self
Expand Down

0 comments on commit f7e7f8b

Please sign in to comment.