inverse_rl icon indicating copy to clipboard operation
inverse_rl copied to clipboard

NotImplementedError with CustomGymEnv ('CustomAnt-v0')

Open lnj0532 opened this issue 6 years ago • 5 comments

Thank you very much for releasing your code. When I run ant_data_collect.py with 'CustomAnt-v0' environment, some problem occured,

Traceback (most recent call last): File "/home/xxx/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/home/xxx/anaconda3/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar return list(map(*args)) File "/home/xxx/inverse_rl_eairl/inverse_rl/utils/hyper_sweep.py", line 47, in kwargs_wrapper return method(**args) File "ant_data_collect.py", line 16, in main env = TfEnv(CustomGymEnv('CustomAnt-v0', record_video=False, record_log=False, force_reset=False)) File "/home/xxx/inverse_rl_eairl/inverse_rl/envs/env_utils.py", line 123, in init video_schedule=FixedIntervalVideoSchedule(50), force_reset=force_reset) File "/home/xxx/inverse_rl_eairl/inverse_rl/envs/env_utils.py", line 35, in init env = gym.envs.make(env_name) File "/home/xxx/software/gym_origin_no_vel/gym/envs/registration.py", line 167, in make return registry.make(id) File "/home/xxx/software/gym_origin_no_vel/gym/envs/registration.py", line 119, in make env = spec.make() File "/home/xxx/software/gym_origin_no_vel/gym/envs/registration.py", line 86, in make env = cls(**self._kwargs) File "/home/xxx/inverse_rl_eairl/inverse_rl/envs/ant_env.py", line 209, in init mujoco_env.MujocoEnv.init(self, f.name, 5) File "/home/xxx/software/gym_origin_no_vel/gym/envs/mujoco/mujoco_env.py", line 42, in init observation, _reward, done, _info = self.step(np.zeros(self.model.nu)) File "/home/xxx/software/gym_origin_no_vel/gym/core.py", line 62, in step raise NotImplementedError NotImplementedError """

The above exception was the direct cause of the following exception: Traceback (most recent call last): File "ant_data_collect.py", line 41, in run_sweep_parallel(main, params_dict, repeat=4) File "/home/xxx/inverse_rl_eairl/inverse_rl/utils/hyper_sweep.py", line 57, in run_sweep_parallel pool.map(kwargs_wrapper, exp_args) File "/home/xxx/anaconda3/lib/python3.6/multiprocessing/pool.py", line 266, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/xxx/anaconda3/lib/python3.6/multiprocessing/pool.py", line 644, in get raise self._value NotImplementedError

could you please tell me how to fix this problem. Thanks

lnj0532 avatar Jan 09 '19 16:01 lnj0532

multiprocessing/pool.py", line 608, in get raise self._value NotImplementedError Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='UTF-8'> BrokenPipeError: [Errno 32] Broken pipe

I have encountered the same problem as you!!! I can't solve it. Have you fixed the problem yet?

lujiayou123 avatar Mar 25 '19 08:03 lujiayou123

It might be due to a different gym version. We used 0.7.4 version of gym that time.

ahq1993 avatar Apr 02 '19 00:04 ahq1993

No ''gaussian_mlp_inverse_policy.py'' in my rllab/sandbox/rocky/tf/policies, neither in https://github.com/rll/rllab/tree/master/sandbox/rocky/tf/policies.

python ant_irl.py Traceback (most recent call last): File "ant_irl.py", line 10, in from sandbox.rocky.tf.policies.gaussian_mlp_inverse_policy import GaussianMLPInversePolicy ImportError: No module named 'sandbox.rocky.tf.policies.gaussian_mlp_inverse_policy'

lujiayou123 avatar Apr 03 '19 06:04 lujiayou123

@lujiayou123 Sorry for the trouble. I have included the gaussain_mlp_inverse_policy.py file in my git. You will have to manually copy it to the sandbox/rocky/tf/policies folder and then the code should work fine. Thanks

ahq1993 avatar Apr 04 '19 00:04 ahq1993

Although I copy the gaussain_mlp_inverse_policy.py file to the sandbox/rocky/tf/policies folder, I get the below error. @ahq1993 Did you update rllab repository??

Traceback (most recent call last):
  File "ant_irl.py", line 65, in <module>
    main()
  File "ant_irl.py", line 54, in main
    baseline=LinearFeatureBaseline(env_spec=env.spec),
  File "/media/usaywook/inverse_rl/inverse_rl/utils/hyperparametrized.py", line 27, in init_wrapper
    return old_init(inst, *args, **kwargs)
  File "/media/usaywook/inverse_rl/inverse_rl/algos/irl_trpo.py", line 19, in __init__
    super(IRLTRPO, self).__init__(optimizer=optimizer, **kwargs)
  File "/media/usaywook/inverse_rl/inverse_rl/utils/hyperparametrized.py", line 27, in init_wrapper
    return old_init(inst, *args, **kwargs)
  File "/media/usaywook/inverse_rl/inverse_rl/algos/irl_npo.py", line 33, in __init__
    super(IRLNPO, self).__init__(**kwargs)
  File "/media/usaywook/inverse_rl/inverse_rl/utils/hyperparametrized.py", line 27, in init_wrapper
    return old_init(inst, *args, **kwargs)
  File "/media/usaywook/inverse_rl/inverse_rl/algos/irl_batch_polopt.py", line 136, in __init__
    self.init_opt()
  File "/media/usaywook/inverse_rl/inverse_rl/algos/irl_npo.py", line 124, in init_opt
    pred = dist.log_likelihood(dist.sample(dist_info_vars),dist_info_vars)+empw_var
  File "/media/usaywook/rllab/sandbox/rocky/tf/distributions/diagonal_gaussian.py", line 80, in sample
    rnd = np.random.normal(size=means.shape)
  File "mtrand.pyx", line 1654, in mtrand.RandomState.normal
  File "mtrand.pyx", line 242, in mtrand.cont2_array_sc
TypeError: __index__ returned non-int (type NoneType)

Usaywook avatar Oct 29 '20 10:10 Usaywook