Skip to content

Commit 285e01f

Browse files
authored
Hotfix: revert loading with weights_only=True (#1913)
1 parent 35eccaf commit 285e01f

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docs/misc/changelog.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,23 @@ Others:
3333
Bug Fixes:
3434
^^^^^^^^^^
3535

36+
Documentation:
37+
^^^^^^^^^^^^^^
38+
39+
Release 2.3.2 (2024-04-27)
40+
--------------------------
41+
42+
Bug Fixes:
43+
^^^^^^^^^^
44+
- Reverted ``torch.load()`` to be called ``weights_only=False`` as it caused loading issue with old version of PyTorch.
45+
46+
3647
Documentation:
3748
^^^^^^^^^^^^^^
3849
- Added ER-MRL to the project page (@corentinlger)
3950
- Updated Tensorboard Logging Videos documentation (@NickLucche)
4051

52+
4153
Release 2.3.1 (2024-04-22)
4254
--------------------------
4355

@@ -55,6 +67,11 @@ Release 2.3.0 (2024-03-31)
5567

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

70+
.. warning::
71+
72+
Because of ``weights_only=True``, this release breaks loading of policies when using PyTorch 1.13.
73+
Please upgrade to PyTorch >= 2.0 or upgrade SB3 version (we reverted the change in SB3 2.3.2)
74+
5875

5976
Breaking Changes:
6077
^^^^^^^^^^^^^^^^^

stable_baselines3/common/save_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ def load_from_zip_file(
447447
file_content.seek(0)
448448
# Load the parameters with the right ``map_location``.
449449
# Remove ".pth" ending with splitext
450-
th_object = th.load(file_content, map_location=device, weights_only=True)
450+
# Note(antonin): we cannot use weights_only=True, as it breaks with PyTorch 1.13, see GH#1911
451+
th_object = th.load(file_content, map_location=device, weights_only=False)
451452
# "tensors.pth" was renamed "pytorch_variables.pth" in v0.9.0, see PR #138
452453
if file_path == "pytorch_variables.pth" or file_path == "tensors.pth":
453454
# PyTorch variables (not state_dicts)

stable_baselines3/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.0a0
1+
2.3.2

0 commit comments

Comments
 (0)