问题描述
今天试图在Atari上运行以下代码时,出现了题目中的bug:
env = AtariPreprocessing(env, grayscale_obs=True, scale_obs=True, terminal_on_life_loss=True)
出现了以下bug:
File "../lib/python3.8/site-packages/gym/wrappers/atari_preprocessing.py", line 76, in __init__
raise ValueError(
ValueError: Disable frame-skipping in the original env. Otherwise, more than one frame-skip will happen as through this wrapper
找遍了全网也没有人说这个是因为什么问题,后来自己去查看了atari_preprocessing.py中的源码:
嗯,看来是由于这个frame_skip参数没有设置导致的,将它设置成1,就可以认为没有进行跳帧操作了。
解决方案
将原先的代码改成:
env = AtariPreprocessing(env, frame_skip=1, grayscale_obs=True, scale_obs=True, terminal_on_life_loss=True)
问题得到圆满解决。