run openai gym with google compute engine

匿名 (未验证) 提交于 2019-12-03 09:05:37

问题:

I was trying to run the CartPole-v0 example on a Google Compute Engine VM. https://gym.openai.com/docs

import gym env = gym.make('CartPole-v0') env.reset() for _ in range(1000):     env.render()     env.step(env.action_space.sample()) # take a random action 

I have XQuartz installed, and ssh with -X.

First, I was getting pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

Then according to http://www.gitterforum.com/discussion/openai-gym?page=28, I use "xvfb-run -s "-screen 0 1400x900x24" /bin/bash"

Then it ran fine with the result:

Making new env: CartPole-v0 You are calling 'step()' even though this environment has already returned done = True. You should always call 'reset()' once you receive 'done = True' -- any further steps are undefined behavior 

But there is nothing rendered...

回答1:

Use code from Observations section on https://gym.openai.com/docs.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!