Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when running in mujoco robotics envrionment, due to the obs dimensionality. #115

Open
WuXinyang2012 opened this issue Feb 19, 2019 · 3 comments

Comments

@WuXinyang2012
Copy link

Hi, thanks for your elegant and clear implementations of SAC and TD3. Your algorithms work quite well in all experiments except the robotics environment.

When I run your algorithm in robotics env, it will return error:

  File "/home/rfa-xw/spinningup/spinup/algos/sac/sac.py", line 139, in sac
    obs_dim = env.observation_space.shape[0]
TypeError: 'NoneType' object is not subscriptable

That's because in robotics environment, the observation is a 10 dimensional dict containing 'observation', 'desired_goal' and 'achieved_goal'. So I changed following in sac.py line 140:

    #obs_dim = env.observation_space.shape[0]
    obs_dim = env.observation_space.spaces['observation'].shape[0]

And also in line 258 for the replay buffer:

        # Store experience to replay buffer
        replay_buffer.store(o['observation'], a, r, o2['observation'], d)

In line 218 for session:

        return sess.run(act_op, feed_dict={x_ph: o['observation'].reshape(1,-1)})[0]

For the full script: the modified sac.py

I hope this could help anyone who wants to play in robotics environment!

@WuXinyang2012 WuXinyang2012 changed the title Cannot work in robotics envrionment due to the observation dimensions. Errors when running in mujoco robotics envrionment, due to the obs dimensionality. Feb 19, 2019
@Bhaney44
Copy link

This is really brilliant work. I ran into the same problem, but I still cannot resolve the issue. How were you able to run the modified sac.py file in the CarRacing-v0 environment? I posted my question in late December here. Would appreciate any help!

@pringithub
Copy link

I'm getting the same error for text environments .. how has this not been changed?

@Bhaney44
Copy link

@pringithub As far as I know the problem hasn't been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants