Skip to content

Latest commit

 

History

History
134 lines (88 loc) · 2.76 KB

File metadata and controls

134 lines (88 loc) · 2.76 KB

OpenAI Gym Install & Setting

Assume we already installed all of deep learning packages we need(tf, pytorch etc.) Also assumes you have an NVIDIA GPU driver.

Install openai-gym

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

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

To save videos, we aslo need to install ffmpeg

sudo apt install ffmpeg

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

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

Use fake screen to get videos

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

  • Change GPU fan setting
sudo nvidia-xconfig -a --cool-bits=4
  • Download the file dfp-edid.bin & move it to /etc/

  • Open xorg.conf

sudo vim /etc/X11/xorg.conf
  • Insert the following three lines in each Section "Screen":

screen

Option      "UseDisplayDevice" "DFP-0"
Option      "ConnectedMonitor" "DFP-0"
Option      "CustomEDID" "DFP-0:/etc/dfp-edid.bin"

  • Restart X server(ex. lightdm)
sudo service lightdm restart
  • Auto login setting

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

[Seat:*]
autologin-guest=false
autologin-user=username
autologin-user-timeout=0

then restart X server again. sudo service lightdm restart

  • Install anydesk
    • Download & upload to your server(via sftp, scp or using wget etc.)
    • Install deb: sudo dpkg -i anydesk.XXX.deb
    • Set password: anydesk --set-password
      • e.g.echo lovefm26671 | anydesk --with-password
    • run anydesk anydesk
    • Get ID: anydesk --get-id
    • (optinal) if it still doesn't work, try to use cmd export DISPLAY=:0
    • see Command Line Interface for more details.

Use AnyDesk

  • Download AnyDesk from official website, windowsx64 version in this tutorial.
  • Double click to run the application(no need to install).
  • Enter the ID we got from remote server.
  • Enter the password.
  • Then,you can see the remote desktop, enjoy it!

anydesk

Run an simple code

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

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

run

Reference