[Feature Request] Gym tuple space mapping
Open
@vmoens is already working on this.
Since Aug 1, 2023.
enhancement
- Dominant language
- Python
- Stars
- 3.6k
- Forks
- 487
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 207
Description
Motivation
TorchRL cannot handle environments with gymnasium.spaces.Tuple observation spaces. I think these are fairly common outside of MuJoCo/Atari envs.
Solution
Support for tuple spaces
Additional context
Traceback (most recent call last):
File "/Users/smorad/code/rqdn/segment_dqn.py", line 92, in <module>
GymWrapper(load_popgym_env(config), device=device),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smorad/code/from_src/torchrl/torchrl/envs/libs/gym.py", line 371, in __init__
super().__init__(**kwargs)
File "/Users/smorad/code/from_src/torchrl/torchrl/envs/common.py", line 1388, in __init__
self._make_specs(self._env) # writes the self._env attribute
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smorad/code/from_src/torchrl/torchrl/envs/libs/gym.py", line 522, in _make_specs
observation_spec = _gym_to_torchrl_spec_transform(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smorad/code/from_src/torchrl/torchrl/envs/libs/gym.py", line 192, in _gym_to_torchrl_spec_transform
raise NotImplementedError("gym.spaces.tuple.Tuple mapping not yet implemented")
NotImplementedError: gym.spaces.tuple.Tuple mapping not yet implemented
Checklist
- I have checked that there is no similar issue in the repo (required)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.