def main(): config = tf.ConfigProto() # Avoid warning message errors os.environ["CUDA_VISIBLE_DEVICES"]="0" # Allowing GPU memory growth config.gpu_options.allow_growth = False with tf.Session(config=config): # 0: {'game': 'SuperMarioBros-Nes', 'state': 'Level1-1'} # 1: {'game': 'SonicTheHedgehog-Genesis', 'state': 'MarbleZone.Act1'}, # 2: {'game': 'SonicTheHedgehog-Genesis', 'state': 'GreenHillZone.Act2'}, # 3: {'game': 'SonicTheHedgehog-Genesis', 'state': 'StarLightZone.Act3'}, # 4: {'game': 'SonicTheHedgehog-Genesis', 'state': 'ScrapBrainZone.Act1'}, # 5: {'game': 'SonicTheHedgehog-Genesis', 'state': 'ScrapBrainZone.Act2'}, # 6: {'game': 'SonicTheHedgehog2-Genesis', 'state': 'MetropolisZone.Act3'}, # 7: {'game': 'SonicTheHedgehog2-Genesis', 'state': 'HillTopZone.Act2'}, # 8: {'game': 'SonicTheHedgehog2-Genesis', 'state': 'CasinoNightZone.Act2'}, # 9: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'LavaReefZone.Act1'}, # 10: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'FlyingBatteryZone.Act2'}, # 11: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'HydrocityZone.Act1'}, # 12: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'AngelIslandZone.Act2'} model.play(policy=policies.PPOPolicy, env= DummyVecEnv([env.make_train_0]), update = 10)
def main(): config = tf.ConfigProto() # Avoid warning message errors os.environ["CUDA_VISIBLE_DEVICES"]="0" # Allowing GPU memory growth config.gpu_options.allow_growth = True with tf.Session(config=config): # 0: {'game': 'SonicTheHedgehog-Genesis', 'state': 'SpringYardZone.Act1'}, # 1: {'game': 'SonicTheHedgehog-Genesis', 'state': 'MarbleZone.Act1'}, # 2: {'game': 'SonicTheHedgehog-Genesis', 'state': 'GreenHillZone.Act2'}, # 3: {'game': 'SonicTheHedgehog-Genesis', 'state': 'StarLightZone.Act3'}, # 4: {'game': 'SonicTheHedgehog-Genesis', 'state': 'ScrapBrainZone.Act1'}, # 5: {'game': 'SonicTheHedgehog-Genesis', 'state': 'ScrapBrainZone.Act2'}, # 6: {'game': 'SonicTheHedgehog2-Genesis', 'state': 'MetropolisZone.Act3'}, # 7: {'game': 'SonicTheHedgehog2-Genesis', 'state': 'HillTopZone.Act2'}, # 8: {'game': 'SonicTheHedgehog2-Genesis', 'state': 'CasinoNightZone.Act2'}, # 9: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'LavaReefZone.Act1'}, # 10: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'FlyingBatteryZone.Act2'}, # 11: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'HydrocityZone.Act1'}, # 12: {'game': 'SonicAndKnuckles3-Genesis', 'state': 'AngelIslandZone.Act2'} model.play(policy=policies.PPOPolicy, env= DummyVecEnv([env.make_train_1]), update = 120)
def main(): config = tf.ConfigProto() # Avoid warning message errors os.environ["CUDA_VISIBLE_DEVICES"] = "0" # Allowing GPU memory growth config.gpu_options.allow_growth = True with tf.Session(config=config): model.play(policy=policies.A2CPolicy, env=DummyVecEnv([env.make_train_0]))
def main(): config = tf.ConfigProto() # Avoid warning message errors os.environ["CUDA_VISIBLE_DEVICES"]="0" # Allowing GPU memory growth config.gpu_options.allow_growth = True with tf.Session(config=config): model.play(policy=policies.A2CPolicy, env= DummyVecEnv([env.make_train_3]))
def main(): config = tf.ConfigProto() os.environ["CUDA_VISIBLE_DEVICES"] = "0" config.gpu_options.allow_growth = True environment_list = [] for i in range(1): environment_list.append(env.make_env) env_vector = SubprocVecEnv(environment_list) with tf.Session(config=config): model.play(policy=policies.A2CNetwork, env=env_vector)
# PongNet = get_trained_model(env) PongNet = load('pong_weights.h5', 'pong_model.json') print ("Testing model") input('Press any key to being testing: ') for i in range(4)[::-1]: print (i+1) time.sleep(1) for i in range(10): print ("Game {}".format(i+1)) observation = env.reset() # for t in range(1,200): t = 0 while True: if (t % 25 == 0): print ('\tTimestep {}'.format(t)) t += 1 env.render() step = play(PongNet, observation.reshape([210,160,3])) observation, reward, done, _ = env.step(step) if done: print ("Exiting game after {} timesteps".format(t+1)) break