Hi @ofirnachum it looks like your environment is not able to start.
I cloned your code, and run python environments/__init__.py --env=AntMaze
, got an error
Traceback (most recent call last):
File "__init__.py", line 125, in
run_environment(args.env_name, args.episode_length, args.num_episodes)
File "__init__.py", line 83, in run_environment
create_maze_env.create_maze_env(env_name),
File "/Users/Alex/Downloads/ant-env/create_maze_env.py", line 30, in create_maze_env
return AntMazeEnv(maze_id=maze_id)
File "/Users/Alex/Downloads/ant-env/maze_env.py", line 191, in __init__
self.wrapped_env = model_cls(args, file_path=file_path, *kwargs)
File "/Users/Alex/Downloads/ant-env/ant.py", line 35, in __init__
mujoco_env.MujocoEnv.__init__(self, file_path, 5)
File "/Users/Alex/anaconda2/envs/rllab3/lib/python3.5/site-packages/gym/envs/mujoco/mujoco_env.py", line 27, in __init__
self.model = mujoco_py.load_model_from_path(fullpath)
File "cymj.pyx", line 122, in mujoco_py.cymj.load_model_from_path
File "cymj.pyx", line 128, in mujoco_py.cymj.load_model_from_path
RuntimeError: Unrecognized extension for /var/folders/fr/wgbc6hrs7dn5dr1550bmv9lsv3jxdh/T/tmpce32fzf2. Expected .xml or .mjb
I am using tensorflow 1.8.0 installed from pip, Mac OS, python version is 3.5.2, conda env, and most recent Gym and mujoco-py==1.5.0.
Hi,
Maybe try changing this line
_, file_path = tempfile.mkstemp(text=True)
to
_, file_path = tempfile.mkstemp(text=True, suffix='.xml')
Hello @ofirnachum
Thanks for responding!
Unfortunately, changing the line gives a new error:
EDIT: in case I changed things myself, I re-clone your code and changed the line to _, file_path = tempfile.mkstemp(text=True, suffix='.xml')
, here is the error.
Traceback (most recent call last):
File "environments/__init__.py", line 129, in
app.run()
File "/Users/Alex/anaconda2/envs/rllab3/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "environments/__init__.py", line 125, in main
run_environment(FLAGS.env, FLAGS.episode_length, FLAGS.num_episodes)
File "environments/__init__.py", line 90, in run_environment
create_maze_env.create_maze_env(env_name),
File "/Users/Alex/Downloads/models/research/efficient-hrl/environments/create_maze_env.py", line 30, in create_maze_env
return AntMazeEnv(maze_id=maze_id)
File "/Users/Alex/Downloads/models/research/efficient-hrl/environments/maze_env.py", line 191, in __init__
self.wrapped_env = model_cls(args, file_path=file_path, *kwargs)
File "/Users/Alex/Downloads/models/research/efficient-hrl/environments/ant.py", line 35, in __init__
mujoco_env.MujocoEnv.__init__(self, file_path, 5)
File "/Users/Alex/anaconda2/envs/rllab3/lib/python3.5/site-packages/gym/envs/mujoco/mujoco_env.py", line 39, in __init__
observation, _reward, done, _info = self.step(np.zeros(self.model.nu))
File "/Users/Alex/Downloads/models/research/efficient-hrl/environments/ant.py", line 55, in step
ob = self._get_obs()
File "/Users/Alex/Downloads/models/research/efficient-hrl/environments/ant.py", line 65, in _get_obs
self.physics.data.qpos.flat[:15], # Ensures only ant obs.
AttributeError: 'mujoco_py.cymj.PyMjModel' object has no attribute 'data'
Seems Gym/Mujoco has changed. Try propagating the changes you see in the gym code. For example, seems now one should use self.sim rather than self.physics (e.g. https://github.com/openai/gym/blob/master/gym/envs/mujoco/ant.py).
Yeah, change self.physics.data
to self.data
makes it works.
Great!
Would you mind updating the code in tensorflow/models
to reflect those changes?
Most helpful comment
Hi,
Maybe try changing this line
_, file_path = tempfile.mkstemp(text=True)
to
_, file_path = tempfile.mkstemp(text=True, suffix='.xml')