def run(self): sess = U.single_threaded_session() sess.__enter__() env = self.make_env() workerseed = self.seed + 10000 * MPI.COMM_WORLD.Get_rank() set_all_seeds(workerseed) env.seed(workerseed) pi = self.make_pi('pi%s' % os.getpid(), env.observation_space, env.action_space) print('Worker %s - Running with seed %s' % (os.getpid(), workerseed)) while True: self.event.wait() self.event.clear() command, weights = self.input.get() if command == 'collect': #print('Worker %s - Collecting...' % os.getpid()) pi.set_parameter(weights) samples = self.traj_segment_generator(pi, env) self.output.put((os.getpid(), samples)) elif command == 'exit': print('Worker %s - Exiting...' % os.getpid()) env.close() sess.close() break
def run(self): sess = U.single_threaded_session() sess.__enter__() env = self.make_env(self.index) self.env = env env.reset() workerseed = self.seed + 10000 * MPI.COMM_WORLD.Get_rank() set_all_seeds(workerseed) env.seed(workerseed) scope = 'pi%s' % os.getpid() pi = self.make_pi(scope, env) var = get_pi_trainable_variables(scope) set_from_flat = U.SetFromFlat(var) print('Worker %s - Running with seed %s' % (os.getpid(), workerseed)) while True: self.event.wait() self.event.clear() command, weights = self.input.get() if command == 'collect': set_from_flat(weights) #print('Worker %s - Collecting...' % os.getpid()) samples = self.traj_segment_generator(pi, env) self.output.put((os.getpid(), samples)) elif command == 'exit': print('Worker %s - Exiting...' % os.getpid()) env.close() sess.close() break
def _thunk(): _env = gym.make(env) _env.seed(seed) set_all_seeds(seed) return _env
def _thunk(): _env = make_atari(env) _env.seed(seed) set_all_seeds(seed) return wrap_deepmind(_env)
def _thunk(): env_rllab = Rllab2GymWrapper(env_rllab_class()) env_rllab.seed(seed) set_all_seeds(seed) return env_rllab
def seed(self, seed=0): set_all_seeds(seed)