Atari 游戏的 Gymnasium 框架中的 Step 函数产生 game_over() 错误

问题描述 投票:0回答:2

我尝试在 python Gymnasium 中加载并运行用于强化学习的 atari 游戏。 每当调用 env.step(action) 函数时,它都会产生以下错误

我的代码是

game_name = 'VideoPinball-v0'
env = wrap_env(gym.make(game_name,
                        render_mode="rgb_array"))
env.reset()

print("Observation Space: ", env.observation_space)
print("Action Space       ", env.action_space)


for _ in range(1000):
  action = env.action_space.sample()
  obs, reward, terminated, truncated, info = env.step(action)

  if terminated:
    observation, info = env.reset()
env.close()

结果:

TypeError: game_over(): 函数参数不兼容。支持以下参数类型:

  1. (self: ale_py._ale_py.ALEInterface) -> bool

调用:; kwargs: with_truncation=False

但是我不清楚根本问题是什么。

python reinforcement-learning
2个回答
0
投票

我使用的是 ale-py 0.75,它与 gymnasium==0.27.1 一起导致错误。 升级到 0.80 解决了这个问题。


-1
投票

有人对此有解决方案吗?

我有同样的错误: TypeError: game_over(): 不兼容的函数参数。支持以下参数类型: 1. (self: ale_py._ale_py.ALEInterface) -> bool

调用:; kwargs: with_truncation=False

上面的解决方案不起作用

© www.soinside.com 2019 - 2024. All rights reserved.