我正在为一个RL项目工作,我需要在一些Atari环境中测试我的想法,我选择Pong来测试最初的想法。为了方便起见,我使用了stable-baselines3 1.6.2版本。我的gym版本是0.21.0。但我得到以下错误,而羡慕。渲染叫做
Exception has occurred: TypeError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
render() takes 1 positional argument but 2 were given
File "/home/s222147455/.conda/envs/new_method/lib/python3.8/site-packages/gym/core.py", line 295, in render
return self.env.render(mode, **kwargs)
File "/home/s222147455/.conda/envs/new_method/lib/python3.8/site-packages/gym/core.py", line 295, in render
return self.env.render(mode, **kwargs)
File "/home/s222147455/.conda/envs/new_method/lib/python3.8/site-packages/gym/core.py", line 295, in render
return self.env.render(mode, **kwargs)
[Previous line repeated 4 more times]
体育馆库被包装如下,
env = AtariWrapper(gym.make(args.env), noop_max=30, frame_skip=4, screen_size=84, terminal_on_life_loss=True, clip_reward=False)
env = DummyVecEnv([lambda: env])
env = VecFrameStack(env, n_stack=4, channels_order='first')
我在谷歌上搜索了这个问题,发现健身房的版本有些不匹配。但我不能完全解决问题
VecFrameStack
不继承它所环绕的env
的render_mode
。没有洞察到为什么会这样,但一个快速的破解/解决方案应该工作:
...
env = DummyVecEnv([lambda: env])
env = VecFrameStack(env, n_stack=4, channels_order='first')
env.render_mode = "rgb_array"
...