0

I'm using MiniGrid library to work with different 2D navigation problems as experiments for my reinforcement learning problem. I'm also using stable-baselines3 library to train PPO models. but unfortunately, while training PPO using stable-baselines3 with MiniGrid environment, I got the following error. Error

I imported the environment as follows,

   import gymnasium as gym
   from minigrid.wrappers import RGBImgObsWrapper
   env = gym.make("MiniGrid-SimpleCrossingS9N1-v0", render_mode="human")
   env = RGBImgObsWrapper(env)
   env = ImgObsWrapper(env)

The training script using stable-baseline3 is as follows,

model = PPO('CnnPolicy', env, verbose=0)
model.learn(args.timesteps, callback)

I have done a quick debug and found a potential lead. I don't know if this is the real cause. When I tried to load the environment directly from the gym the action space <class 'gym.spaces.discrete.Discrete'>. But when loaded from MiniGrid the action space is <class 'gymnasium.spaces.discrete.Discrete'>. Any help to sort out the problem is highly appreciated. Thanks in advance

user19826638
  • 31
  • 1
  • 4

1 Answers1

0

That's the correct analysis, Stable Baselines3 doesn't support Gymnasium yet, so checks on gym.spaces.discrete.Discrete fail against gymnasium.

The following post answer explains how to workaround that, based on a currently open PR: OpenAI Gymnasium, are there any libraries with algorithms supporting it?.

tacon
  • 321
  • 1
  • 6