Command Utils¶
Helpers for scripts like run_atari.py.
-
stable_baselines.common.cmd_util.
arg_parser
()[source]¶ Create an empty argparse.ArgumentParser.
Returns: (ArgumentParser)
-
stable_baselines.common.cmd_util.
atari_arg_parser
()[source]¶ Create an argparse.ArgumentParser for run_atari.py.
Returns: (ArgumentParser) parser {‘–env’: ‘BreakoutNoFrameskip-v4’, ‘–seed’: 0, ‘–num-timesteps’: int(1e7)}
-
stable_baselines.common.cmd_util.
make_atari_env
(env_id, num_env, seed, wrapper_kwargs=None, start_index=0, allow_early_resets=True, start_method=None, use_subprocess=False)[source]¶ Create a wrapped, monitored VecEnv for Atari.
Parameters: - env_id – (str) the environment ID
- num_env – (int) the number of environment you wish to have in subprocesses
- seed – (int) the initial seed for RNG
- wrapper_kwargs – (dict) the parameters for wrap_deepmind function
- start_index – (int) start rank index
- allow_early_resets – (bool) allows early reset of the environment
- start_method – (str) method used to start the subprocesses. See SubprocVecEnv doc for more information
- use_subprocess – (bool) Whether to use SubprocVecEnv or DummyVecEnv when num_env > 1, DummyVecEnv is usually faster. Default: False
Returns: (VecEnv) The atari environment
-
stable_baselines.common.cmd_util.
make_mujoco_env
(env_id, seed, allow_early_resets=True)[source]¶ Create a wrapped, monitored gym.Env for MuJoCo.
Parameters: - env_id – (str) the environment ID
- seed – (int) the initial seed for RNG
- allow_early_resets – (bool) allows early reset of the environment
Returns: (Gym Environment) The mujoco environment
-
stable_baselines.common.cmd_util.
make_robotics_env
(env_id, seed, rank=0, allow_early_resets=True)[source]¶ Create a wrapped, monitored gym.Env for MuJoCo.
Parameters: - env_id – (str) the environment ID
- seed – (int) the initial seed for RNG
- rank – (int) the rank of the environment (for logging)
- allow_early_resets – (bool) allows early reset of the environment
Returns: (Gym Environment) The robotic environment
-
stable_baselines.common.cmd_util.
make_vec_env
(env_id, n_envs=1, seed=None, start_index=0, monitor_dir=None, wrapper_class=None, env_kwargs=None, vec_env_cls=None, vec_env_kwargs=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