Skip to content

Commit

Permalink
Hotfix: revert loading with weights_only=True (#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
araffin committed Apr 27, 2024
1 parent 35eccaf commit 285e01f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions docs/misc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ Others:
Bug Fixes:
^^^^^^^^^^

Documentation:
^^^^^^^^^^^^^^

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)
--------------------------

Expand All @@ -55,6 +67,11 @@ 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
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 285e01f

Please sign in to comment.