From 7aabb64d24d93f865a91342049a2170863c596b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20GALLOU=C3=89DEC?= Date: Fri, 10 Feb 2023 14:17:44 +0100 Subject: [PATCH 1/2] Update doc --- docs/guide/examples.rst | 34 ++++++++++++++++++++++++++++++---- docs/misc/changelog.rst | 1 + 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/guide/examples.rst b/docs/guide/examples.rst index 2bdb8d862f..668eea935c 100644 --- a/docs/guide/examples.rst +++ b/docs/guide/examples.rst @@ -721,13 +721,39 @@ to keep track of the agent progress. model.learn(10_000) -SB3 with EnvPool or Isaac Gym ------------------------------ +SB3 and EnvPool +--------------- -Just like Procgen (see above), `EnvPool `_ and `Isaac Gym `_ accelerate the environment by +`EnvPool `_ is a C++-based batched environment pool with pybind11 and thread pool. +Just like ProcgenEnv (see above), it is already vectorized. +To use EnvPool with SB3, you must the ``EnvPoolAdapter`` from `RL Zoo `_. + + +.. code-block:: python + + import envpool + from rl_zoo3.vec_env_wrappers import EnvPoolAdapter + + from stable_baselines3 import PPO + from stable_baselines3.common.vec_env import VecMonitor + + # Create the environment (VizDoom/Basic-v1) + venv = EnvPoolAdapter(envpool.make("Basic-v1", env_type="gym", num_envs=16, seed=42)) + + # Wrap with a VecMonitor to collect stats and avoid errors + venv = VecMonitor(venv=venv) + + model = PPO("CnnPolicy", venv, verbose=1) + model.learn(100_000) + + +SB3 and Isaac Gym +----------------- + +Just like Procgen and EnvPool (see above), `Isaac Gym `_ accelerate the environment by already providing a vectorized implementation. -To use SB3 with those tools, you must wrap the env with tool's specific ``VecEnvWrapper`` that will pre-process the data for SB3, +To use SB3 with Isaac Gym, you must wrap the env with tool's specific ``VecEnvWrapper`` that will pre-process the data for SB3, you can find links to those wrappers in `issue #772 `_. diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index 6fafd9968f..e9e8b564de 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -45,6 +45,7 @@ Documentation: - Renamed ``load_parameters`` to ``set_parameters`` (@DavyMorgan) - Clarified documentation about subproc multiprocessing for A2C (@Bonifatius94) - Fixed typo in ``A2C`` docstring (@AlexPasqua) +- Added ``EnvPoolAdaptater`` example in doc about EnvPool support Release 1.7.0 (2023-01-10) From 4c3bc98240adb4b600743cafcba71dc62181aa9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:26:04 +0100 Subject: [PATCH 2/2] fix missing "use" --- docs/guide/examples.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/examples.rst b/docs/guide/examples.rst index 668eea935c..a722281c14 100644 --- a/docs/guide/examples.rst +++ b/docs/guide/examples.rst @@ -726,7 +726,7 @@ SB3 and EnvPool `EnvPool `_ is a C++-based batched environment pool with pybind11 and thread pool. Just like ProcgenEnv (see above), it is already vectorized. -To use EnvPool with SB3, you must the ``EnvPoolAdapter`` from `RL Zoo `_. +To use EnvPool with SB3, you must use the ``EnvPoolAdapter`` from `RL Zoo `_. .. code-block:: python