[关闭]
@BIGBALLON 2017-10-15T00:01:29.000000Z 字数 1737 阅读 1499

OpenAI Gym Install & Setting

Assume we already install all of other packages we need(tf, pytorch etc.)

Install openai-gym


In order to install openai-gym, we should setup the following packages:

  1. sudo apt install cmake swig zlib1g-dev python3-tk -y

To save videos, we aslo need to install ffmpeg

  1. sudo apt install ffmpeg

Then, we can setup openai-gym by the following commands:

  1. git clone https://github.com/openai/gym
  2. cd gym
  3. pip3 install gym[all]

Using fake screen to get videos


Because remote server has no display device, so we can't see the training process and save videos.
So we will use the following method to get the remote screen.

  1. sudo nvidia-xconfig -a --cool-bits=4
  1. sudo vim /etc/X11/xorg.conf

  1. Option "UseDisplayDevice" "DFP-0"
  2. Option "ConnectedMonitor" "DFP-0"
  3. Option "CustomEDID" "DFP-0:/etc/dfp-edid.bin"
  1. sudo service lightdm restart

bulid(or modify) file /etc/lightdm/lightdm.conf
write the following lines:

  1. [Seat:*]
  2. autologin-guest=false
  3. autologin-user=username
  4. autologin-user-timeout=0

then restart X server again.

Use AnyDesk


Run an simple code


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

You can see the environment works fine!
Take it easy!

Reference


添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注