@BIGBALLON
2017-10-15T08:01:29.000000Z
字数 1737
阅读 1726
Assume we already install all of other packages we need(tf, pytorch etc.)
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]
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.
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
Option "UseDisplayDevice" "DFP-0"
Option "ConnectedMonitor" "DFP-0"
Option "CustomEDID" "DFP-0:/etc/dfp-edid.bin"
sudo service lightdm restart
bulid(or modify) file /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 dpkg -i anydesk.XXX.deb
anydesk --set-password
anydesk --get-id
anydesk
export DISPLAY=:0
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!