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

Env Observation space dimension error whenever I try to train any model #191

Open
ashwinipokle opened this issue Apr 28, 2019 · 6 comments

Comments

@ashwinipokle
Copy link

Hello,

I followed steps mentioned here to install requirements for this repository. There is one minor change, I am using virtualenv instead of conda to install pytorch. I wanted to test my installation and I tried to train model using the commands mentioned in this section. I am unable to get any model to train. Everytime I get the following error.

Traceback (most recent call last):
File "main.py", line 14, in
from a2c_ppo_acktr import algo, utils
File "/home/admin/ppo_mm/pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/algo/init.py", line 1, in
from .a2c_acktr import A2C_ACKTR
File "/home/admin/ppo_mm/pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/algo/a2c_acktr.py", line 5, in
from a2c_ppo_acktr.algo.kfac import KFACOptimizer
File "/home/admin/ppo_mm/pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/algo/kfac.py", line 8, in
from a2c_ppo_acktr.utils import AddBias
File "/home/admin/ppo_mm/pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/utils.py", line 7, in
from a2c_ppo_acktr.envs import VecNormalize
File "/home/admin/ppo_mm/pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/envs.py", line 146
assert len(op) == 3, f"Error: Operation, {str(op)}, must be dim3"

@ashwinipokle
Copy link
Author

ashwinipokle commented Apr 28, 2019

Quick update: I followed installation instructions in anaconda environment and I still get a similar error whenever I try to train model.
Traceback (most recent call last):
File "main.py", line 166, in
main()
File "main.py", line 46, in main
base_kwargs={'recurrent': args.recurrent_policy})
File "/home/admin/ppo_mm/pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/model.py", line 21, in init
if len(obs_shape) == 3:
TypeError: object of type 'NoneType' has no len()

Seems like this is an issue with the version of OpenAI gym being used. Could you please let me know which version of OpenAI gym is compatible with the codebase ?

@YuiiCh
Copy link

YuiiCh commented May 21, 2019

me too

@ikostrikov
Copy link
Owner

ikostrikov commented May 21, 2019

It seems to work for me (I tested it with the latest versions of gym and baselines). Could you check whether you install the latest versions of gym and baselines?

I ran

 python main.py --env-name "PongNoFrameskip-v4"

@niagl
Copy link

niagl commented Jun 11, 2019

Tried with latest versions of gym and baseline. The issue still remains. Any ideas here ?

@YuiiCh
Copy link

YuiiCh commented Jun 12, 2019 via email

@henrycharlesworth
Copy link

henrycharlesworth commented Jul 2, 2019

For me it was because I was using Python 3.5, once I updated to 3.6 it was working (I was getting the error: pytorch-a2c-ppo-acktr-gail/a2c_ppo_acktr/envs.py", line 146
assert len(op) == 3, f"Error: Operation, {str(op)}, must be dim3")

Looking at the code there:

super(TransposeImage, self).init(env)
assert len(op) == 3, f"Error: Operation, {str(op)}, must be dim3"

It's using an f-string which is only supported in >=Python 3.6. So I think this means that this code won't work in Python 3.5 (which is annoying, as I can only get mujoco-py to run in python 3.5... but that's a whole different issue!). It might be worth mentioning this somewhere!

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

5 participants