evorl.envs.envpool¶
Module Contents¶
Classes¶
Adapter for EnvPool to support EnvPool environments. |
|
Vectorized one-episode wrapper for evaluation. |
Functions¶
Create an EnvPool environment with Gymnasium API. |
|
API¶
- class evorl.envs.envpool.EnvPoolGymAdapter(env_name: str, max_episode_steps: int, num_envs: int, discount: float | None = None, **env_kwargs)¶
Bases:
evorl.envs.env.EnvAdapterAdapter for EnvPool to support EnvPool environments.
This env already is a vectorized environment and has experimental supports. It is not recommended to direcly replace other jax-based envs with this env in EvoRL’s existing workflows. Users should carefully check the compatibility and modify the corresponding code to avoid the side-effects and other undefined behaviors.
Caution
This env breaks the rule of pure functions. Its env state is maintained inside the envpool. Thesefore, users should use it with caution. Unlike other jax-based envs, this env has following limitations:
No support for recovering from previous env state.
In other word, you can’t rewind after calling
env.step.For example, you can’t resume the training from a checkpoint exactly as before; Similarly,
evorl.rollout.eval_rollout_episodewill also result in undefined behavior.
- property action_space: evorl.envs.space.Space¶
- property obs_space: evorl.envs.space.Space¶
- reset(key: chex.PRNGKey) evorl.envs.env.EnvState¶
- setup_env_callback()¶
- step(state: evorl.envs.env.EnvState, action: evorl.types.Action) evorl.envs.env.EnvState¶
- class evorl.envs.envpool.OneEpisodeWrapper(env: evorl.envs.env.Env)¶
Bases:
evorl.envs.wrappers.WrapperVectorized one-episode wrapper for evaluation.
- step(state: evorl.envs.env.EnvState, action: evorl.types.Action) evorl.envs.env.EnvState¶
- evorl.envs.envpool.create_envpool_env(env_name, episode_length: int = 1000, parallel: int = 1, autoreset_mode: evorl.envs.wrappers.AutoresetMode = AutoresetMode.ENVPOOL, discount: float | None = 1.0, **kwargs) evorl.envs.envpool.EnvPoolGymAdapter¶
Create an EnvPool environment with Gymnasium API.
Unlike other jax-based env, most wrappers are handled inside the envpool.
- evorl.envs.envpool.gym_space_to_evorl_space(space: gymnasium.Space) evorl.envs.space.Space¶