1. Baselines简介
Baselines是一个传统强化学习的资源库,github地址为:https://github.com/openai/baselines
Baselines需要python3的环境,建议使用3.6版本。安装openmpi和相关库(tensorflow、gym),mac可以使用brew安装,ubuntu可以使用apt-get,centos可以使用pip安装。
git clone https://github.com/openai/baselines.git
cd baselines
pip install -e .
用下面的语句检查是否安装成功。如果提示缺少某个库,安装即可
pip install pytest
pytest
安装完可进行可视化:
python -m baselines.run --alg=ppo2 --env=PongNoFrameskip-v4 --num_timesteps=2e7 --save_path=~/models/pong_20M_ppo2
python -m baselines.run --alg=ppo2 --env=PongNoFrameskip-v4 --num_timesteps=0 --load_path=~/models/pong_20M_ppo2 --play
根据官方文档,spinning up实现的算法包括:
- A2C
- ACER
- ACKTR
- DDPG
- DQN
- GAIL
- HER
- PPO1
- PPO2
- TRPO
2. Spinning Up简介
spinning up是一个深度强化学习的很好的资源,其网址是:https://spinningup.openai.com/en/latest/
首先需要python3.6环境,建议下载anaconda3~这里要注意安装版本问题,目前使用python3.5和python3.7都存在问题。然后安装openmpi和相关库(tensorflow、gym),mac可以使用brew安装,ubuntu可以使用apt-get,centos可以使用pip安装。接下来执行下面的步骤:
git clone https://github.com/openai/spinningup.git
cd spinningup
pip install -e .
用下面的语句检查是否安装成功。如果提示缺少某个库,安装即可
python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999
安装完可进行可视化:
python -m spinup.run test_policy data/installtest/installtest_s0
python -m spinup.run plot data/installtest/installtest_s0
根据官方文档,spinning up实现的算法包括:
- Vanilla Policy Gradient (VPG)
- Trust Region Policy Optimization (TRPO)
- Proximal Policy Optimization (PPO)
- Deep Deterministic Policy Gradient (DDPG)
- Twin Delayed DDPG (TD3)
- Soft Actor-Critic (SAC)