Skip to content

[BUG] torchrl doesn't support minigrid gymnasium environments #1467

Closed
@kbkartik

Description

I am trying to parallelize FourRooms minigrid environment using torchrl. Following is my code:

class MinigridGymWrapper(GymWrapper):
    """FARAMA Minigrid environment wrapper."""

    git_url = "https://github.com/Farama-Foundation/Minigrid"
    libname = "minigrid"

    _make_specs = set_gym_backend("gymnasium")(GymEnv._make_specs)

with set_gym_backend(gym):
    assert gym_backend() == gym
    print(gym_backend())
    gym_env = MinigridGymWrapper(gym.make("BabyAI-KeyCorridorS6R3-v0"))

I get the following output with error:

<module 'gymnasium' from '/usr/local/lib/python3.10/dist-packages/gymnasium/__init__.py'>

[/usr/local/lib/python3.10/dist-packages/torchrl/envs/libs/gym.py](https://localhost:8080/#) in _gym_to_torchrl_spec_transform(spec, dtype, device, categorical_action_encoding)
    264         )
    265     else:
--> 266         raise NotImplementedError(
    267             f"spec of type {type(spec).__name__} is currently unaccounted for"
    268         )

NotImplementedError: spec of type BabyAIMissionSpace is currently unaccounted for

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions