def _init(): set_global_seeds(seed) env = DonkeyVAEEnv(level=LEVEL, frame_skip=frame_skip, vae=vae, const_throttle=None, min_throttle=MIN_THROTTLE, max_throttle=MAX_THROTTLE, max_cte_error=MAX_CTE_ERROR, n_command_history=N_COMMAND_HISTORY, n_stack=n_stack) env.seed(seed) if not teleop: env = Monitor(env, log_dir, allow_early_resets=True) return env
log_path) assert os.path.isfile( model_path), "No model found for {} on {}, path: {}".format( algo, ENV_ID, model_path) model = ALGOS[algo].load(model_path) if args.vae_path != '': print("Loading VAE ...") vae = load_vae(args.vae_path) if vae is None: N_COMMAND_HISTORY = 0 env = DonkeyVAEEnv(level=LEVEL, frame_skip=TEST_FRAME_SKIP, vae=vae, const_throttle=None, min_throttle=MIN_THROTTLE, max_throttle=MAX_THROTTLE, max_cte_error=10, n_command_history=N_COMMAND_HISTORY) env = Recorder(env, folder=args.record_folder, verbose=1) try: env = TeleopEnv(env, model=model) env.wait() except KeyboardInterrupt as e: pass finally: env.exit() time.sleep(0.5)