Metaworld icon indicating copy to clipboard operation
Metaworld copied to clipboard

Dtype of observation space does not match returned observation

Open ottofabian opened this issue 1 year ago • 0 comments

Currently, the observation space does not specify a dtype, which means it defaults to float32, however the returned numpy array is by default in float64. This will lead to exceptions with more recent versions of gym as they introduced explicit checks if the returned observations are contained in the observation space. Hence, I propose to either add the dtype to the Box space constructor https://github.com/rlworkgroup/metaworld/blob/18118a28c06893da0f363786696cc792457b062b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py#L385-L403 and/or cast the returned values from step() and reset() to the appropriate dtype.

The same thing should probably be done for the action space as well https://github.com/rlworkgroup/metaworld/blob/18118a28c06893da0f363786696cc792457b062b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py#L128-L131

ottofabian avatar Jul 06 '22 14:07 ottofabian