How to use OpenAI baselines
This article mainly explains how to use OpenAI baselines. Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "How to use OpenAI baselines"!
The first is to install the gym environment
This article uses Atari games, so you need to install them in gym, otherwise some games may not be installed by default:
pip install -e '. [atari]'
These are the exact words:
The Atari environments are a variety of Atari video games. If you didn’t do the full install, you can install dependencies via pip install -e ‘. [atari]’ (you’ll need cmake installed) and then get started as follow:
import gymenv = gym.make('SpaceInvaders-v0')env.reset()env.render()
The next step is the clone baselines repository:
git clone https://github.com/openai/baselines.git
Then enter the directory to run:
The table of contents reads as follows:
total 48drwxrwxr-x 6 jqw jqw 4096 Jun 8 16:50 .drwxrwxr-x 3 jqw jqw 4096 Jun 7 11:07 .. drwxrwxr-x 15 jqw jqw 4096 Jun 8 19:42 baselinesdrwxr-xr-x 2 root root 4096 Jun 8 16:50 baselines.egg-infodrwxrwxr-x 2 jqw jqw 4096 Jun 7 11:08 data-rw-rw-r-- 1 jqw jqw 504 Jun 7 11:08 Dockerfiledrwxrwxr-x 8 jqw jqw 4096 Jun 7 11:08 .git-rw-rw-r-- 1 jqw jqw 285 Jun 7 11:08 .gitignore-rw-rw-r-- 1 jqw jqw 1087 Jun 7 11:08 LICENSE-rw-rw-r-- 1 jqw jqw 3417 Jun 7 11:08 README.md-rw-rw-r-- 1 jqw jqw 957 Jun 7 11:08 setup.py-rw-rw-r-- 1 jqw jqw 224 Jun 7 11:08 .travis.ymlpython3 -m baselines.a2c.run_atari
It's OK, the other algorithms are the same reason.
Note: This is python3,
Then you need to install numpy, matplotlib, tensorflow, etc. under python3, omitted here
At this point, I believe that everyone has a deeper understanding of "how to use OpenAI baselines", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!