Man*_*edi 9 python reinforcement-learning openai-gym
我正在与 RL 代理合作,并试图复制本文的发现,其中他们基于 Gym 开放 AI 制作了一个自定义跑酷环境,但是当我尝试渲染这个环境时遇到了问题。
import numpy as np
import time
import gym
import TeachMyAgent.environments
env = gym.make('parametric-continuous-parkour-v0', agent_body_type='fish', movable_creepers=True)
env.set_environment(input_vector=np.zeros(3), water_level = 0.1)
env.reset()
while True:
_, _, d, _ = env.step(env.action_space.sample())
env.render(mode='human')
time.sleep(0.1)
c:\users\manu dwivedi\teachmyagent\TeachMyAgent\environments\envs\parametric_continuous_parkour.py in render(self, mode, draw_lidars)
462
463 def render(self, mode='human', draw_lidars=True):
--> 464 from gym.envs.classic_control import rendering
465 if self.viewer is None:
466 self.viewer = rendering.Viewer(RENDERING_VIEWER_W, RENDERING_VIEWER_H)
ImportError: cannot import name 'rendering' from 'gym.envs.classic_control' (C:\ProgramData\Anaconda3\envs\teachagent\lib\site-packages\gym\envs\classic_control\__init__.py)
[1]: https://github.com/flowersteam/TeachMyAgent
Run Code Online (Sandbox Code Playgroud)
我认为这可能是这个自定义环境以及作者决定渲染它的方式的问题,但是,当我尝试
from gym.envs.classic_control import rendering
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的错误,github 用户建议这可以通过rendor_mode='human'在调用渲染时添加来解决gym.make(),但这似乎只适用于他们的特定情况。
我(在同学的帮助下)通过将gym软件包降级到 0.21.0 来让它工作。pip install gym==0.21.0为此执行了命令。
更新,来自 Github 问题:
基于https://github.com/openai/gym/issues/2779
这应该是gymgrid的问题,有一个开放的PR:wsgdrfz/gymgrid#1
如果你想使用gym的最新版本,你可以尝试使用该PR的分支(https://github.com/CedricHermansBIT/健身房网格2);你可以安装它pip install gymgrid2
| 归档时间: |
|
| 查看次数: |
8682 次 |
| 最近记录: |