Add note on loading and resetting environments (#340)

* Update documentation and changelog

* Fix docs

* Update examples.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
This commit is contained in:
Anssi 2021-03-05 18:05:14 +02:00 committed by GitHub
parent 65100a4b04
commit f13de5b57b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -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. 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. 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. 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>`. 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 .. code-block:: python
from stable_baselines3 import SAC from stable_baselines3 import SAC

View file

@ -14,6 +14,7 @@ Documentation:
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
- Fixed examples - Fixed examples
- Added new project using SB3: rl_reach (@PierreExeter) - 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) Pre-Release 0.11.1 (2021-02-27)