Skip to content

Commit

Permalink
Add warmup for event stall handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Mar 14, 2024
1 parent 4c9d569 commit 9e95a4e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pokemonred_puffer/cleanrl_puffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def __init__(
self.infos = {}
self.log = False
self.ent_coef = self.config.ent_coef
self.events_avg = deque([0] * 500, maxlen=500)
self.events_avg = deque(maxlen=500)

@pufferlib.utils.profile
def evaluate(self):
Expand Down Expand Up @@ -438,7 +438,10 @@ def evaluate(self):
self.pool.send(actions)

self.events_avg.append(np.mean(self.infos["learner"]["stats/event"]))
if math.abs(self.events_avg[-1] - self.events_avg[0]) < 3:
if (
len(self.events_avg) == self.events_avg.maxlen
and math.abs(self.events_avg[-1] - self.events_avg[0]) < 3
):
self.ent_coef = self.config.ent_coef * 1.25
else:
self.ent_coef = self.config.ent_coef
Expand Down

0 comments on commit 9e95a4e

Please sign in to comment.