diff --git a/docs/guide/examples.rst b/docs/guide/examples.rst index 61b1fd1a33..b3f2493d53 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 use 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 c3c662959b..6af3685d80 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -48,6 +48,8 @@ Documentation: - Fixed typo in ``A2C`` docstring (@AlexPasqua) - Renamed timesteps to episodes for ``log_interval`` description (@theSquaredError) - Removed note about gif creation for Atari games (@harveybellini) +- Added ``EnvPoolAdaptater`` example in doc about EnvPool support + Release 1.7.0 (2023-01-10) --------------------------