Skip to content

Commit

Permalink
debugging wonky logging (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmncs authored Feb 21, 2019
1 parent a25b9ab commit 6350d1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions safe_grid_agents/common/agents/policy_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def gather_rollout(self, env, env_state, history, args) -> Rollout:
state = successor
history["t"] += 1

if r != 0:
history["episode"] += 1

returns = self.get_discounted_returns(rewards)
history = track_metrics(history, env)
rollout.states.append(states)
Expand Down
3 changes: 3 additions & 0 deletions safe_grid_agents/common/agents/policy_crmdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ def gather_rollout(self, env, env_state, history, args) -> Rollout:
state = successor
history["t"] += 1

if r != 0:
history["episode"] += 1

self.identify_corruption_in_trajectory(successors_r, rewards)
rewards = self.get_modified_rewards_for_rollout(successors_r, rewards)

Expand Down
4 changes: 2 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def train(args, config=None, reporter=noop):
agent, env, history, args = warmup_fn(agent, env, history, args)

######## Learn (and occasionally evaluate) ########
history["t"], eval_history["period"] = 0, 0
history["t"], history["episode"], eval_history["period"] = 0, 0, 0

for episode in range(args.episodes):
env_state = (
Expand All @@ -65,7 +65,7 @@ def train(args, config=None, reporter=noop):
False,
{"hidden_reward": 0.0, "observed_reward": 0.0},
)
history["episode"] = episode
history["episode"] += 1
env_state, history, eval_next = learn_fn(agent, env, env_state, history, args)
info = env_state[3]
reporter(
Expand Down

0 comments on commit 6350d1b

Please sign in to comment.