Skip to content

Commit

Permalink
Make sure the first snapshot time is always logged.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxenburg committed Sep 6, 2024
1 parent bbf2f4c commit 7ed6411
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions flybody/agents/learning_dmpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,11 @@ def step(self):

if self._snapshotter is not None:
if self._snapshotter.save():
# Log at what actor_steps this snapshot was saved.
if 'actor_steps' in fetches:
fetches['saved_snapshot_at_actor_steps'] = fetches['actor_steps']
# Log at what actor_steps this snapshot was saved. The actor_steps
# counter is updated at end of episode so fetches['actor_steps']
# may not exist yet when the first policy snapshot is saved.
actor_steps = fetches['actor_steps'] if 'actor_steps' in fetches else 0
fetches['saved_snapshot_at_actor_steps'] = actor_steps
# Increment the snapshot counter (directly in the snapshotter's path).
for path in list(self._snapshotter._snapshots.keys()):
snapshot = self._snapshotter._snapshots[path] # noqa: F841
Expand Down

0 comments on commit 7ed6411

Please sign in to comment.