rll / rllab

rllab is a framework for developing and evaluating reinforcement learning algorithms, fully compatible with OpenAI Gym.
Other
2.89k stars 803 forks source link

Problem running rllab MazeAntEnv #238

Open ahq1993 opened 6 years ago

ahq1993 commented 6 years ago

Code: .. from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.normalized_env import normalize from rllab.envs.mujoco.maze.ant_maze_env import AntMazeEnv

def main(exp_name=None, ent_wt=1.0): tf.reset_default_graph() env = normalize(AntMazeEnv())

policy = GaussianMLPPolicy(name='policy', env_spec=env.spec, hidden_sizes=(32, 32))
with tf.Session(config=get_session_config()) as sess:
    algo = TRPO(
        env=env,
        sess=sess,
        policy=policy,
        n_itr=2000,
        batch_size=20000,
        max_path_length=500,
        discount=0.99,
        store_paths=True,
        entropy_weight=ent_wt,
        baseline=LinearFeatureBaseline(env_spec=env.spec),
        exp_name=exp_name,
    )
    with rllab_logdir(algo=algo, dirname='data/ant_data_collect'):#/%s'%exp_name):
        algo.train()

if name == "main": params_dict = { 'ent_wt': [0.1] } main(ent_wt=0.1)

Error:

Traceback (most recent call last): File "ant_data_collect.py", line 47, in main(ent_wt=0.1) File "ant_data_collect.py", line 24, in main policy = GaussianMLPPolicy(name='policy', env_spec=env.spec, hidden_sizes=(32, 32)) File "/home/ahmed/tf-codes/inverse_rl_orignal_maze/scripts/sandbox/rocky/tf/policies/gaussian_mlp_policy.py", line 56, in init assert isinstance(env_spec.action_space, Box) AssertionError

ahq1993 commented 6 years ago

Any suggestion guys?

ahq1993 commented 6 years ago

I also tried with removing normalize() and using CategoricalML policy but then it gives an error at assert isinstance(env_spec.action_space, Discrete).