Fix loading of old versions and update changelog (#165)

This commit is contained in:
Antonin RAFFIN 2020-09-24 16:05:36 +02:00 committed by GitHub
parent 9855486488
commit 44a723eecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -3,12 +3,15 @@
Changelog Changelog
========== ==========
Pre-Release 0.9.0a1 (WIP) Pre-Release 0.9.0a2 (WIP)
------------------------------ ------------------------------
Breaking Changes: Breaking Changes:
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
- Removed ``device`` keyword argument of policies; use ``policy.to(device)`` instead. (@qxcv) - Removed ``device`` keyword argument of policies; use ``policy.to(device)`` instead. (@qxcv)
- Rename ``BaseClass.get_torch_variables`` -> ``BaseClass._get_torch_save_params`` and
``BaseClass.excluded_save_params`` -> ``BaseClass._excluded_save_params``
- Renamed saved items ``tensors`` to ``pytorch_variables`` for clarity
New Features: New Features:
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
@ -35,12 +38,9 @@ Others:
- Fix type annotation of ``make_vec_env`` (@ManifoldFR) - Fix type annotation of ``make_vec_env`` (@ManifoldFR)
- Removed ``AlreadySteppingError`` and ``NotSteppingError`` that were not used - Removed ``AlreadySteppingError`` and ``NotSteppingError`` that were not used
- Fixed typos in SAC and TD3 - Fixed typos in SAC and TD3
- Rename ``BaseClass.get_torch_variables`` -> ``BaseClass._get_torch_save_params`` and
``BaseClass.excluded_save_params`` -> ``BaseClass._excluded_save_params``
- Reorganized functions for clarity in ``BaseClass`` (save/load functions close to each other, private - Reorganized functions for clarity in ``BaseClass`` (save/load functions close to each other, private
functions at top) functions at top)
- Clarified docstrings on what is saved and loaded to/from files - Clarified docstrings on what is saved and loaded to/from files
- Renamed saved items ``tensors`` to ``pytorch_variables`` for clarity
- Simplified ``save_to_zip_file`` function by removing duplicate code - Simplified ``save_to_zip_file`` function by removing duplicate code
- Store library version along with the saved models - Store library version along with the saved models

View file

@ -404,7 +404,8 @@ def load_from_zip_file(
# Load the parameters with the right ``map_location``. # Load the parameters with the right ``map_location``.
# Remove ".pth" ending with splitext # Remove ".pth" ending with splitext
th_object = th.load(file_content, map_location=device) th_object = th.load(file_content, map_location=device)
if file_path == "pytorch_variables.pth": # "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) # PyTorch variables (not state_dicts)
pytorch_variables = th_object pytorch_variables = th_object
else: else:

View file

@ -1 +1 @@
0.9.0a1 0.9.0a2