Cognitive-AI-Systems/pogema

Unable to perform training pogema_v0 environment

Closed this issue · 2 comments

I'm trying to run the below code

import gymnasium as gym
from pogema import pogema_v0, GridConfig

# Create Pogema environment with PettingZoo interface
env = gym.make("Pogema-v0", grid_config=GridConfig(size=8, density=0.3, num_agents=1, max_episode_steps=30))
from stable_baselines3 import DQN

dqn_agent = DQN('MlpPolicy', env, verbose=1, tensorboard_log="./dqn_pogema_tensorboard/")
dqn_agent.learn(1000000, log_interval=1000, eval_env=env, tb_log_name="baseline")

But it fails in the last before line and I get the following error:

AssertionError: The algorithm only supports (<class 'gym.spaces.discrete.Discrete'>,) as action spaces but Discrete(5) was provided

It appears to me that there is a confusion between gymnasium and gym since both are used in this piece of code. Not sure how to fix this error.

I attempted to replicate the issue but was unsuccessful. Could you please check the following Google Colab link ? Also, which setup did you use? (versions of Pogema, SB3 and gymnasium)

Hello @Tviskaron , I was able to resolve the issue, by modifying the library versions. I've mentioned the details below:

Old: Pogema 1.2.2 | SB3 1.6.1 | Gymnasium 0.29.1
New: Pogema 1.2.2 | SB3 2.1.0 | Gymnasium 0.28.1

Thanks