Baseline项目安装
Baseline项目主页: https://github.com/openai/baselines 将项目从GitHub上面下载下来
git clone https://github.com/openai/baselines.git
 安装tensorflow,版本号为1.14(这里是cpu版本,主页中也给出了GPU版本的下载方式)
cd baselines/
pip install tensorflow==1.14
等待安装完毕后,安装所有其他的依赖库
pip install -e .
如果有部分库安装失败的话,可以对照baseline/setup.py文件看一下里面要求的哪些包,然后根据自己安装失败的包的报错代码搜索一下相关资料。 之后,官方给出了一个用pytest来检验的方法。
pip install pytest
pytest
运行pytest之后,可以发现找到了一个错误  然后我们往上面翻找,查找错误出在哪里,可以看到是matplotlib库没有安装  这里我们用pip把他安装上
pip install matplotlib
之后我们再运行pytest,如果还有错误就继续安装缺失的包,直到错误消失。
Baseline调试-示例运行
在不断的调试过程中,这里有一个比较奇怪的错误值得注意一下,错误信息为:
Exception: ROM is missing for pong, see https://github.com/openai/atari-py
这里我们首先需要去下载一下Roms http://www.atarimania.com/rom_collection_archive_atari_2600_roms.html 然后再在把他们解压到一个文件夹(Roms.rar解压之后还是两个压缩包,接着解压)  然后运行下面这个命令即可
python -m atari_py.import_roms /home/qch/Roms
后面的路径就是你放这些刚刚解压出来的文件夹的路径。 错误解决完以后,尝试着运行一下用例 按照官网中给出的示例,运行命令
python -m baselines.run --alg=deepq --env=PongNoFrameskip-v4 --num_timesteps=1e6
后面只需要漫长的等待即可。。  经过长时间的等待,可以看到奖励值从负的一点点跑到正的,最终在17.8结束。  至此,我们的首次实验就成功了,接下来就根据具体的文件来配合一起学习代码的含义和个人的理解。
|