Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.09k stars 604 forks source link

[Bug Report] MiniGrid ViewSizeWrapper doesn't seem to working anymore #311

Closed subho406 closed 1 year ago

subho406 commented 1 year ago

Descrption Seems like the ViewSizeWrapper is not working anymore. I have tried reproducing the results in Google Colab and Mac M1.

Code:

import gymnasium as gym
import matplotlib.pyplot as plt
from minigrid.wrappers import ViewSizeWrapper
import minigrid
env = gym.make("MiniGrid-DoorKey-5x5-v0")
obs, _ = env.reset()
print(obs['image'].shape)

env_obs = ViewSizeWrapper(env, agent_view_size=5)
obs, _ = env_obs.reset()
print(obs['image'].shape)

Output:

(7, 7, 3)
(7, 7, 3)

System Info Describe the characteristic of your environment:

Checklist

xixiha5230 commented 1 year ago

same problem

BolunDai0216 commented 1 year ago

I think the issue is not using the newest version of Minigrid. Can you clone the master branch and see if that fixes it?

The issue that you mentioned should be resolved by PR #305. Using the newest Minigrid version, after running the code you provided, I get

(7, 7, 3)
(5, 5, 3)
subho406 commented 1 year ago

Yes, that works! So the issue was ViewSizeWrapper was inheriting the wrong class. Thanks!

jbloomAus commented 1 year ago

We can probably close this issue since it's solved by the current code?