MCPcopy Index your code
hub / github.com/rlcode/reinforcement-learning / make_env

Function make_env

3-atari/env.py:86–105  ·  view source on GitHub ↗

Create an Atari env with the standard preprocessing pipeline.

(args)

Source from the content-addressed store, hash-verified

84
85
86def make_env(args):
87 """Create an Atari env with the standard preprocessing pipeline."""
88 env_id = ENV_IDS[args.env]
89 # frameskip=1 here because AtariPreprocessing applies its own.
90 env = gym.make(env_id, frameskip=1,
91 render_mode="human" if (args.render or args.test) else None)
92 env = gym.wrappers.AtariPreprocessing(
93 env,
94 noop_max=30,
95 frame_skip=4,
96 screen_size=84,
97 terminal_on_life_loss=False, # handled by LifeLossTerminalEnv below
98 grayscale_obs=True,
99 scale_obs=False, # keep uint8; we normalize in the model
100 )
101 if "FIRE" in env.unwrapped.get_action_meanings():
102 env = FireResetEnv(env)
103 env = LifeLossTerminalEnv(env)
104 env = gym.wrappers.FrameStackObservation(env, stack_size=4)
105 return env
106
107
108def make_vec_env(args, n_envs):

Callers 3

2-ppo.pyFile · 0.90
1-dqn.pyFile · 0.90
make_vec_envFunction · 0.70

Calls 2

FireResetEnvClass · 0.85
LifeLossTerminalEnvClass · 0.85

Tested by

no test coverage detected