Open lilmrmagoo opened 11 months ago
Hello,
I think you need to specify spaces.MultiDiscrete([1, 2])
instead of spaces.MultiDiscrete([[1,2]])
that does seem to be related to the issue although an example given in the gymnasium docs for MultiDiscrete is
observation_space = MultiDiscrete(np.array([[1, 2], [3, 4]]), seed=42)
observation_space.sample()
array([[0, 0],
[2, 2]])
which causes the issue as well, specifically I wish to use MultiDiscrete(np.array([[13, 13], [9, 8]]))
for my environment and I had just simplified it for the example.
n example given in the gymnasium docs for MultiDiscrete is
we do not support everything that Gymnasium allows (a warning is indeed missing in the env checker).
What you have should be equivalent to MultiDiscrete([13, 13, 9, 8])
.
I see, would be great if that was mentioned somewhere or was part of the env check. Not sure if that constitutes leaving this issue open or not.
was part of the env check.
I would be happy to receive a PR that adds a warning in the env checker ;).
Hey,when trying to run my highway script on multi-agent settings, I run into this error: " File ~.conda\envs\spyder\Lib\site-packages\stable_baselines3\common\base_class.py:180 in init assert isinstance(self.action_space, supported_action_spaces), (
AssertionError: The algorithm only supports (<class 'gymnasium.spaces.discrete.Discrete'>,) as action spaces but Tuple(Discrete(5), Discrete(5)) was provided"
How to solve the issue ? Here is my env config: config= {"action": { "type": "MultiAgentAction", "action_config":{ "type":"DiscreteMetaAction", "longitudinal": True, "lateral": True, "target_speeds": [50, 60, 70, 80], },
},
"observation":{
"type":"MultiAgentObservation",
"observation_config":{
"type": "Kinematics",
"vehicles_count": 8,
"features": [
"presence",
"x",
"y",
"vx",
"vy",
"cos_h",
"sin_h"
],
"absolute": False
},
},
"lanes_count": 3, "vehicles_count": 10, "controlled_vehicles": 2, "collision_reward": -1, "right_lane_reward": 0, "high_speed_reward": 1, "lane_change_reward": 0.1, "reward_speed_range": [20, 30]},render_mode="rgb_array")
🐛 Bug
Using a Dict or Tuple observation space and a MultiDiscrete action space together causes PPO or A2C models to fail. If you swap either space to be a box the issue is resolved. The environment will pass the checker without any issue but fail when setting up the model.
Code example
Relevant log output / Error message
System Info
Checklist