Observation mode "pixel" raises AttributeError
phlippe opened this issue · 2 comments
phlippe commented
Hi, when trying to create an environment that runs in the observation mode "pixel", the environment crashes due to the attribute self.observation_space
not being defined:
from causal_world.envs import CausalWorld
from causal_world.task_generators.task import generate_task
task = generate_task(task_generator_id='stacked_blocks')
env = CausalWorld(task=task,
observation_mode='pixel')
Error:
File causalworld.py:238, in CausalWorld._reset_observations_space(self)
237 def _reset_observations_space(self):
--> 238 if self._observation_mode == "pixel" and self.observation_space is None:
239 self._stage.select_observations(["goal_image"])
240 self.observation_space = combine_spaces(
241 self._robot.get_observation_spaces(),
242 self._stage.get_observation_spaces())
AttributeError: 'CausalWorld' object has no attribute 'observation_space'
I am not sure if this might be caused by a new gym version. A quick fix is to simply define self.observation_space = None
before calling self._reset_observations_space()
in the init (line 171).
ftraeuble commented
Thanks for bringing this to our attention. I believe this is indeed due to a new gym version. Could you try to see if you still experience that error with the latest master version?
phlippe commented
Hi @ftraeuble, thanks for checking! Enforcing an older gym version (0.17.2), as in the new master, removes the error for me.