mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-07-25 19:48:33 +00:00
save_replay_buffer now receives as argument the file path instead of the folder path (#63)
* save_replay_buffer now receives as argument the file path instead of the folder path * Update changelog.rst Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
This commit is contained in:
parent
a861f33107
commit
644d2c17ac
3 changed files with 5 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ Pre-Release 0.8.0a0 (WIP)
|
|||
|
||||
Breaking Changes:
|
||||
^^^^^^^^^^^^^^^^^
|
||||
- ``save_replay_buffer`` now receives as argument the file path instead of the folder path (@tirafesi)
|
||||
|
||||
New Features:
|
||||
^^^^^^^^^^^^^
|
||||
|
|
@ -325,3 +326,4 @@ And all the contributors:
|
|||
@Miffyli @dwiel @miguelrass @qxcv @jaberkow @eavelardev @ruifeng96150 @pedrohbtp @srivatsankrishnan @evilsocket
|
||||
@MarvineGothic @jdossgollin @SyllogismRXS @rusu24edward @jbulow @Antymon @seheevic @justinkterry @edbeeching
|
||||
@flodorner @KuKuXia @NeoExtended @PartiallyTyped @mmcenta @richardwu @kinalmehta @rolandgvc @tkelestemur @mloo3
|
||||
@tirafesi
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@ class OffPolicyAlgorithm(BaseAlgorithm):
|
|||
"""
|
||||
Save the replay buffer as a pickle file.
|
||||
|
||||
:param path: (str) Path to a log folder
|
||||
:param path: (str) Path to the file where the replay buffer should be saved
|
||||
"""
|
||||
assert self.replay_buffer is not None, "The replay buffer is not defined"
|
||||
with open(os.path.join(path, 'replay_buffer.pkl'), 'wb') as file_handler:
|
||||
with open(path, 'wb') as file_handler:
|
||||
pickle.dump(self.replay_buffer, file_handler)
|
||||
|
||||
def load_replay_buffer(self, path: str):
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ def test_save_load_replay_buffer(model_class):
|
|||
model = model_class('MlpPolicy', 'Pendulum-v0', buffer_size=1000)
|
||||
model.learn(500)
|
||||
old_replay_buffer = deepcopy(model.replay_buffer)
|
||||
model.save_replay_buffer(log_folder)
|
||||
model.save_replay_buffer(replay_path)
|
||||
model.replay_buffer = None
|
||||
model.load_replay_buffer(replay_path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue