Closed AsadJeewa closed 4 months ago
This file seems outdated: https://github.com/Farama-Foundation/Minigrid/blob/master/docs/content/training.md
What line exactly is causing errors?
When using the policy_kwargs in line 15: model = PPO("CnnPolicy", env, policy_kwargs=policy_kwargs, verbose=1)
return self.features_extractor_class(self.observation_space, **self.features_extractor_kwargs)
TypeError: 'module' object is not callable
So the issue is with the MinigridFeaturesExtractor
import minigrid
from minigrid.wrappers import ImgObsWrapper
from stable_baselines3 import PPO
import MinigridFeaturesExtractor
import gymnasium as gym
policy_kwargs = dict(
features_extractor_class=MinigridFeaturesExtractor,
features_extractor_kwargs=dict(features_dim=128),
)
env = gym.make("MiniGrid-Empty-16x16-v0", render_mode="rgb_array")
env = ImgObsWrapper(env)
model = PPO("CnnPolicy", env, policy_kwargs=policy_kwargs, verbose=1)
model.learn(2e5)
Apologies I was importing from MinigridFeaturesExtractor
incorrectly. Changed it to from MinigridFeaturesExtractor import MinigridFeaturesExtractor
However, the team should add the imports to the example.
Describe the bug Cannot run example code: TypeError: 'module' object is not callable
Code example https://minigrid.farama.org/content/training/
Checklist