(train=False, dumpdir=None)
| 46 | |
| 47 | |
| 48 | def get_player(train=False, dumpdir=None): |
| 49 | use_gym = not ENV_NAME.endswith(".bin") |
| 50 | if use_gym: |
| 51 | env = gym.make(ENV_NAME) |
| 52 | else: |
| 53 | from atari import AtariPlayer |
| 54 | env = AtariPlayer(ENV_NAME, frame_skip=4, viz=False, |
| 55 | live_lost_as_eoe=train, max_num_frames=60000, |
| 56 | grayscale=False) |
| 57 | if dumpdir: |
| 58 | env = gym.wrappers.Monitor(env, dumpdir, video_callable=lambda _: True) |
| 59 | env = FireResetEnv(env) |
| 60 | env = MapState(env, lambda im: cv2.resize(im, IMAGE_SIZE)) |
| 61 | env = FrameStack(env, 4) |
| 62 | if train and use_gym: |
| 63 | env = LimitLength(env, 60000) |
| 64 | return env |
| 65 | |
| 66 | |
| 67 | class MySimulatorWorker(SimulatorProcess): |
no test coverage detected
searching dependent graphs…