Command Utils

stable_baselines3.common.cmd_util.make_atari_env(env_id: Union[str, Type[gym.core.Env]], n_envs: int = 1, seed: Optional[int] = None, start_index: int = 0, monitor_dir: Optional[str] = None, wrapper_kwargs: Optional[Dict[str, Any]] = None, env_kwargs: Optional[Dict[str, Any]] = None, vec_env_cls: Optional[Union[stable_baselines3.common.vec_env.dummy_vec_env.DummyVecEnv, stable_baselines3.common.vec_env.subproc_vec_env.SubprocVecEnv]] = None, vec_env_kwargs: Optional[Dict[str, Any]] = None)[source]

Create a wrapped, monitored VecEnv for Atari. It is a wrapper around make_vec_env that includes common preprocessing for Atari games.

Parameters
  • env_id – (str or Type[gym.Env]) the environment ID or the environment class

  • n_envs – (int) the number of environments you wish to have in parallel

  • seed – (int) the initial seed for the random number generator

  • start_index – (int) start rank index

  • monitor_dir – (str) Path to a folder where the monitor files will be saved. If None, no file will be written, however, the env will still be wrapped in a Monitor wrapper to provide additional information about training.

  • wrapper_kwargs – (Dict[str, Any]) Optional keyword argument to pass to the AtariWrapper

  • env_kwargs – (Dict[str, Any]) Optional keyword argument to pass to the env constructor

  • vec_env_cls – (Type[VecEnv]) A custom VecEnv class constructor. Default: None.

  • vec_env_kwargs – (Dict[str, Any]) Keyword arguments to pass to the VecEnv class constructor.

Returns

(VecEnv) The wrapped environment

stable_baselines3.common.cmd_util.make_vec_env(env_id: Union[str, Type[gym.core.Env]], n_envs: int = 1, seed: Optional[int] = None, start_index: int = 0, monitor_dir: Optional[str] = None, wrapper_class: Optional[Callable] = None, env_kwargs: Optional[Dict[str, Any]] = None, vec_env_cls: Optional[Union[stable_baselines3.common.vec_env.dummy_vec_env.DummyVecEnv, stable_baselines3.common.vec_env.subproc_vec_env.SubprocVecEnv]] = None, vec_env_kwargs: Optional[Dict[str, Any]] = None)[source]

Create a wrapped, monitored VecEnv. By default it uses a DummyVecEnv which is usually faster than a SubprocVecEnv.

Parameters
  • env_id – (str or Type[gym.Env]) the environment ID or the environment class

  • n_envs – (int) the number of environments you wish to have in parallel

  • seed – (int) the initial seed for the random number generator

  • start_index – (int) start rank index

  • monitor_dir – (str) Path to a folder where the monitor files will be saved. If None, no file will be written, however, the env will still be wrapped in a Monitor wrapper to provide additional information about training.

  • wrapper_class – (gym.Wrapper or callable) Additional wrapper to use on the environment. This can also be a function with single argument that wraps the environment in many things.

  • env_kwargs – (dict) Optional keyword argument to pass to the env constructor

  • vec_env_cls – (Type[VecEnv]) A custom VecEnv class constructor. Default: None.

  • vec_env_kwargs – (dict) Keyword arguments to pass to the VecEnv class constructor.

Returns

(VecEnv) The wrapped environment