MCPcopy Create free account
hub / github.com/rlcode/reinforcement-learning / make_vec_env

Function make_vec_env

4-atari-hard/env.py:184–206  ·  view source on GitHub ↗

envpool vector env. Returns (n_envs, 4, 84, 84) uint8 obs and accepts int32 actions of shape (n_envs,). `info` is a single dict of per-env arrays; `info["terminated"]` is the real game-over signal (lives==0). envpool's `observation_space` / `action_space` are already the single-env

(args, n_envs, seed=0)

Source from the content-addressed store, hash-verified

182
183
184def make_vec_env(args, n_envs, seed=0):
185 """envpool vector env. Returns (n_envs, 4, 84, 84) uint8 obs and accepts
186 int32 actions of shape (n_envs,). `info` is a single dict of per-env
187 arrays; `info["terminated"]` is the real game-over signal (lives==0).
188
189 envpool's `observation_space` / `action_space` are already the single-env
190 spaces (no `single_*` aliases like gymnasium vector envs)."""
191 _, pool_id = ENV_IDS[args.env]
192 return envpool.make_gymnasium(
193 pool_id,
194 num_envs=n_envs,
195 seed=seed,
196 stack_num=4,
197 frame_skip=4,
198 gray_scale=True,
199 img_height=84, img_width=84,
200 noop_max=30,
201 episodic_life=False, # life loss does not end the episode
202 use_fire_reset=True, # auto-FIRE on reset for games that need it
203 repeat_action_probability=0.25, # v5-equivalent sticky actions
204 reward_clip=False, # we sign-clip in the training loop
205 max_episode_steps=27_000, # standard Atari time limit
206 )
207
208
209def pick_device(arg="auto"):

Callers 1

1-ppo-rnd.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected