Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
araffin authored May 3, 2024
2 parents 4fc16bd + 285e01f commit 126c3d2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
6 changes: 5 additions & 1 deletion docs/guide/tensorboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ Here is an example of how to render an episode and log the resulting video to Te
import gymnasium as gym
import torch as th
import numpy as np
from stable_baselines3 import A2C
from stable_baselines3.common.callbacks import BaseCallback
Expand Down Expand Up @@ -226,6 +227,9 @@ Here is an example of how to render an episode and log the resulting video to Te
:param _locals: A dictionary containing all local variables of the callback's scope
:param _globals: A dictionary containing all global variables of the callback's scope
"""
# We expect `render()` to return a uint8 array with values in [0, 255] or a float array
# with values in [0, 1], as described in
# https://pytorch.org/docs/stable/tensorboard.html#torch.utils.tensorboard.writer.SummaryWriter.add_video
screen = self._eval_env.render(mode="rgb_array")
# PyTorch uses CxHxW vs HxWxC gym (and tensorflow) image convention
screens.append(screen.transpose(2, 0, 1))
Expand All @@ -239,7 +243,7 @@ Here is an example of how to render an episode and log the resulting video to Te
)
self.logger.record(
"trajectory/video",
Video(th.ByteTensor([screens]), fps=40),
Video(th.from_numpy(np.asarray([screens])), fps=40),
exclude=("stdout", "log", "json", "csv"),
)
return True
Expand Down
24 changes: 20 additions & 4 deletions docs/misc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ New Features:

Bug Fixes:
^^^^^^^^^^
- Fix memory leak when loading learner from storage (@peteole)

`SB3-Contrib`_
^^^^^^^^^^^^^^
Expand All @@ -35,28 +36,43 @@ Bug Fixes:

Documentation:
^^^^^^^^^^^^^^
- Added ER-MRL to the project page

Release 2.3.2 (2024-04-27)
--------------------------

Bug Fixes:
^^^^^^^^^^
- Reverted ``torch.load()`` to be called ``weights_only=False`` as it caused loading issue with old version of PyTorch.


Documentation:
^^^^^^^^^^^^^^
- Added ER-MRL to the project page (@corentinlger)
- Updated Tensorboard Logging Videos documentation (@NickLucche)


Release 2.3.1 (2024-04-22)
--------------------------

Bug Fixes:
^^^^^^^^^^
- Fix memory leak when loading learner from storage (@peteole)
- Cast return value of learning rate schedule to float, to avoid issue when loading model because of ``weights_only=True`` (@markscsmith)

Documentation:
^^^^^^^^^^^^^^
- Updated SBX documentation (CrossQ and deprecated DroQ)
- Updated RL Tips and Tricks section


Release 2.3.0 (2024-03-31)
--------------------------

**New defaults hyperparameters for DDPG, TD3 and DQN**

.. warning::

Because of ``weights_only=True``, this release breaks loading of policies when using PyTorch 1.13.
Please upgrade to PyTorch >= 2.0 or upgrade SB3 version (we reverted the change in SB3 2.3.2)


Breaking Changes:
^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1642,4 +1658,4 @@ And all the contributors:
@anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong @ReHoss
@DavyMorgan @luizapozzobon @Bonifatius94 @theSquaredError @harveybellini @DavyMorgan @FieteO @jonasreiher @npit @WeberSamuel @troiganto
@lutogniew @lbergmann1 @lukashass @BertrandDecoster @pseudo-rnd-thoughts @stefanbschneider @kyle-he @PatrickHelm @corentinlger
@marekm4 @stagoverflow @rushitnshah @markscsmith @peteole
@marekm4 @stagoverflow @rushitnshah @markscsmith @NickLucche @peteole
3 changes: 2 additions & 1 deletion stable_baselines3/common/save_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ def load_from_zip_file(
file_content.seek(0)
# Load the parameters with the right ``map_location``.
# Remove ".pth" ending with splitext
th_object = th.load(file_content, map_location=device, weights_only=True)
# Note(antonin): we cannot use weights_only=True, as it breaks with PyTorch 1.13, see GH#1911
th_object = th.load(file_content, map_location=device, weights_only=False)
# "tensors.pth" was renamed "pytorch_variables.pth" in v0.9.0, see PR #138
if file_path == "pytorch_variables.pth" or file_path == "tensors.pth":
# PyTorch variables (not state_dicts)
Expand Down
2 changes: 1 addition & 1 deletion stable_baselines3/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.0a0
2.3.2

0 comments on commit 126c3d2

Please sign in to comment.