Skip to content

Commit

Permalink
reward logging fix
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoPasini committed Sep 1, 2024
1 parent ffc41ed commit c41028e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dreamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def agent_update(
def rollout(
self,
):
total_rewards = 0
for t in range(self.batch_train_freq):
self.num_timesteps += 1
done = False
Expand Down Expand Up @@ -258,8 +259,10 @@ def rollout(
self.replayBuffer.add(self.last_obs, action, timestep.reward, obs, done)
self.last_obs = obs

# Log rewards incrementally
wandb.log({"reward": timestep.reward, "num_timesteps": self.num_timesteps})
total_rewards += timestep.reward

# Log total rewards after every rollout
wandb.log({"total_rewards": total_rewards, "num_timesteps": self.num_timesteps})

def train(
self,
Expand Down
Binary file modified __pycache__/Dreamer.cpython-310.pyc
Binary file not shown.

0 comments on commit c41028e

Please sign in to comment.