gym atri新版

问题

atri在新版的2.0 gym上atri-py已经分离到ale上,使用旧版api报错

The environment `SpaceInvaders` has been moved out of Gym to the package `ale-py`. Please install the package via `pip install ale-py`. You can instantiate the new namespaced environment as `ALE/SpaceInvaders`.

改使用ale,并使用ale-import-roms 导入ROMS和Atri
测试版本:

gym==0.23.1
ale-py==0.7.5 

1 ale安装`

pip install ale-py

2 导入ROMS

下载Roms.rar,然后在win下面解压再拷贝回来ubuntu(#bug linux下解压Roms内存会无限增长,解压失败 ),主要导入atri的bin文件到ale_py的包下rom目录下。

ale-import-roms Roms/

gym中使用

代码中不建议使用render, 在初始化指定render_mode即可。

import gym
env = gym.make('ALE/SpaceInvaders-v5',
    obs_type='rgb',                   # ram | rgb | grayscale
    frameskip=4,                      # frame skip
    mode=None,                        # game mode, see Machado et al. 2018
    difficulty=None,                  # game difficulty, see Machado et al. 2018
    repeat_action_probability=0.25,   # Sticky action probability
    full_action_space=False,          # Use all actions
    render_mode='human'               # None | human | rgb_array
)

# test
env.reset()
for _ in range(10000):
    a = env.action_space.sample()
    s_prime, r, done, info = env.step(a)

gym atri新版_第1张图片

你可能感兴趣的:(Deep,Reforcement,Learning,python,机器学习)