Skip to content

Commit

Permalink
Fix ProgressBarCallback under-reporting (#1260)
Browse files Browse the repository at this point in the history
* Updated tqdm progress bar constructor to account for the effects of train_freq/n_steps/num_envs on total_timesteps. Ensure progress bar is "flushed" on training end.

* Added description of PR #1260. Fixed formatting typo

* Partial revert

Co-authored-by: dominicgkerr <dominicgkerr1@gmail.co>
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
Co-authored-by: Antonin Raffin <antonin.raffin@dlr.de>
  • Loading branch information
4 people committed Jan 10, 2023
1 parent 30a1984 commit 5aa6e7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/misc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ New Features:

Bug Fixes:
^^^^^^^^^^
- Updated ``ProgressBarCallback`` to more accurately display the proportion of remaining timesteps (@dominicgkerr)
- Fixed return type of ``evaluate_actions`` in ``ActorCritcPolicy`` to reflect that entropy is an optional tensor (@Rocamonde)
- Fixed type annotation of ``policy`` in ``BaseAlgorithm`` and ``OffPolicyAlgorithm``
- Allowed model trained with Python 3.7 to be loaded with Python 3.8+ without the ``custom_objects`` workaround
Expand Down Expand Up @@ -180,7 +181,7 @@ Others:
^^^^^^^
- Fixed ``DictReplayBuffer.next_observations`` typing (@qgallouedec)
- Added support for ``device="auto"`` in buffers and made it default (@qgallouedec)
- Updated ``ResultsWriter` (used internally by ``Monitor`` wrapper) to automatically create missing directories when ``filename`` is a path (@dominicgkerr)
- Updated ``ResultsWriter`` (used internally by ``Monitor`` wrapper) to automatically create missing directories when ``filename`` is a path (@dominicgkerr)

Documentation:
^^^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion stable_baselines3/common/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,5 +685,6 @@ def _on_step(self) -> bool:
return True

def _on_training_end(self) -> None:
# Close progress bar
# Flush and close progress bar
self.pbar.refresh()
self.pbar.close()

0 comments on commit 5aa6e7d

Please sign in to comment.