Skip to content

Commit

Permalink
copy hidden state
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Apr 25, 2024
1 parent 095d8fc commit ff618f9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pokemonred_puffer/cleanrl_puffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ def evaluate(self):
)
self.env_recv_queues[i + 1].put(self.infos["learner"]["state"][new_state])
waiting_for.append(i + 1)
# Now copy the hidden state over
# This may be a little slow, but so is this whole process
self.next_lstm_state[0][:, i, :] = self.next_lstm_state[0][:, new_state, :]
self.next_lstm_state[1][:, i, :] = self.next_lstm_state[1][:, new_state, :]
for i in waiting_for:
self.env_send_queues[i].get()
print("State migration complete")
Expand Down

0 comments on commit ff618f9

Please sign in to comment.