Ejemplo n.º 1
0
def read_proto(filename):
    results = results_pb2.MethodResult()
    with open(filename, 'rb') as f:
        results.ParseFromString(f.read())
    return results
Ejemplo n.º 2
0
FLAGS = parser.parse_args()


def set_global_seed(seed):
    tf.set_random_seed(seed)
    np.random.seed(seed)


if __name__ == "__main__":
    env_name = FLAGS.env_name
    env = gym.make(env_name)
    env.seed(FLAGS.seed)
    set_global_seed(FLAGS.seed)
    print(FLAGS)

    results = results_pb2.MethodResult()

    # setting evaluation policy
    if FLAGS.pi == 4:
        pi = GaussianPolicy(env.observation_space,
                            env.action_space,
                            scope='pi',
                            train_type='reinforce',
                            hidden_sizes=[64, 64],
                            act_fn=tf.nn.tanh)
        #pi = GaussianPolicy(env.observation_space, env.action_space, scope='pi', train_type = 'reinforce', hidden_sizes = [16, 16])
        pi.load_policy(FLAGS.pi_weightfile)

    # setting behavior policy
    if FLAGS.pi_b == 4:
        pi_b = pi