Skip to content

Instantly share code, notes, and snippets.

@AurelianTactics
Last active August 25, 2019 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AurelianTactics/2e01e6225510662b3c355af092c5edbc to your computer and use it in GitHub Desktop.
Save AurelianTactics/2e01e6225510662b3c355af092c5edbc to your computer and use it in GitHub Desktop.
def make_env(env_id, log_dir, rank):
def _init():
env = UnityEnv(env_id, worker_id=rank, use_visual=False)
env = Monitor(env, log_dir, allow_early_resets=True)
return _init
env_id = "unity_ray/basic_env_linux/basic_env_linux"
num_env = 2
worker_id = 9
env = SubprocVecEnv([make_env(env_id, log_dir, i+worker_id) for i in range(num_env)])
model = PPO2(MlpPolicy, env, verbose=1)
model.learn(total_timesteps=10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment