Skip to content

Commit

Permalink
Add note on loading and resetting environments (DLR-RM#340)
Browse files Browse the repository at this point in the history
* Update documentation and changelog

* Fix docs

* Update examples.rst

Co-authored-by: Antonin RAFFIN <[email protected]>
  • Loading branch information
Miffyli and araffin authored Mar 5, 2021
1 parent 65100a4 commit f13de5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docs/guide/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,22 @@ By default, the replay buffer is not saved when calling ``model.save()``, in ord
However, SB3 provides a ``save_replay_buffer()`` and ``load_replay_buffer()`` method to save it separately.


.. image:: ../_static/img/colab-badge.svg
:target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/advanced_saving_loading.ipynb

Stable-Baselines3 automatic creation of an environment for evaluation.
For that, you only need to specify ``create_eval_env=True`` when passing the Gym ID of the environment while creating the agent.
Behind the scene, SB3 uses an :ref:`EvalCallback <callbacks>`.


.. note::

For training model after loading it, we recommend loading the replay buffer to ensure stable learning (for off-policy algorithms).
You also need to pass ``reset_num_timesteps=True`` to ``learn`` function which initializes the environment
and agent for training if a new environment was created since saving the model.


.. image:: ../_static/img/colab-badge.svg
:target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/advanced_saving_loading.ipynb


.. code-block:: python
from stable_baselines3 import SAC
Expand Down
1 change: 1 addition & 0 deletions docs/misc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Documentation:
^^^^^^^^^^^^^^
- Fixed examples
- Added new project using SB3: rl_reach (@PierreExeter)
- Add a note on continual learning and resetting environment


Pre-Release 0.11.1 (2021-02-27)
Expand Down

0 comments on commit f13de5b

Please sign in to comment.