MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / main

Function main

rl3/a2c/play.py:30–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29
30def main():
31 env_id = get_args().env
32 env = make_atari(env_id)
33 env = wrap_deepmind(env, frame_stack=True, clip_rewards=False, episode_life=True)
34 env = Monitor(env)
35 # rewards will appear higher than during training since rewards are not clipped
36
37 agent = get_agent(env)
38
39 # check for save path
40 save_path = os.path.join('models', env_id + '.save')
41 agent.load(save_path)
42
43 obs = env.reset()
44 renders = []
45 while True:
46 obs = np.expand_dims(obs.__array__(), axis=0)
47 a, v = agent.step(obs)
48 obs, reward, done, info = env.step(a)
49 env.render()
50 if done:
51 print(info)
52 env.reset()
53
54
55if __name__ == '__main__':

Callers 1

play.pyFile · 0.70

Calls 10

resetMethod · 0.95
stepMethod · 0.95
make_atariFunction · 0.90
wrap_deepmindFunction · 0.90
MonitorClass · 0.90
get_agentFunction · 0.85
__array__Method · 0.80
get_argsFunction · 0.70
loadMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected