text: #!/usr/bin/env python
  import os, logging, gym
  from baselines import logger
  from baselines.common import set_global_seeds
  from baselines import bench
  from baselines.ordering.a2c import learn
  from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
  from baselines.common.atari_wrappers import make_atari, wrap_deepmind
  from baselines.ordering.policies import CnnPolicy
  
  def train(env_id, num_timesteps, seed, policy, lrschedule, num_cpu):
      def make_env(rank):
          def _thunk():
              #env = make_atari(env_id)
              env = gym.make(env_id)
              env.seed(seed + rank)
              env = bench.Monitor(env, logger.get_dir() and os.path.join(logger.get_dir(), str(rank)))
              gym.logger.setLevel(logging.WARN)
              #return wrap_deepmind(env)
              return env
          return _thunk
      set_global_seeds(seed)
      env = SubprocVecEnv([make_env(i) for i in range(num_cpu)])
      if policy == 'cnn':
          policy_fn = CnnPolicy
      elif policy == 'lstm':
          policy_fn = LstmPolicy
      elif policy == 'lnlstm':
          policy_fn = LnLstmPolicy
      learn(policy_fn, env, seed, nstack=1, total_timesteps=int(num_timesteps * 1.1), lrschedule=lrschedule) 
      env.close()
  
  def main():
      import argparse
      parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
      parser.add_argument('--env', help='environment ID', default='MyBox-v0')
      parser.add_argument('--seed', help='RNG seed', type=int, default=0)
      parser.add_argument('--policy', help='Policy architecture', choices=['cnn', 'lstm', 'lnlstm'], default='cnn')
      parser.add_argument('--lrschedule', help='Learning rate schedule', choices=['constant', 'linear'], default='constant')
      #parser.add_argument('--num-timesteps', type=int, default=int(10e6))
      parser.add_argument('--num-timesteps', type=int, default=int(10e10))
      args = parser.parse_args()
      logger.configure()
      train(args.env, num_timesteps=args.num_timesteps, seed=args.seed,
          policy=args.policy, lrschedule=args.lrschedule, num_cpu=16) 
  
  if __name__ == '__main__':
      main()
  