提交 de84714e 编写于 作者: Z zenghsh3

Update README

上级 4a9aed3d
...@@ -17,43 +17,42 @@ Based on PaddlePaddle's next-generation API Fluid, the DQN model of deep reinfor ...@@ -17,43 +17,42 @@ Based on PaddlePaddle's next-generation API Fluid, the DQN model of deep reinfor
# How to use # How to use
### Dependencies: ### Dependencies:
+ python2.7 + python2.7
+ gym + gym
+ tqdm + tqdm
+ opencv-python + opencv-python
+ paddlepaddle-gpu>=0.12.0 + paddlepaddle-gpu>=0.12.0
+ ale_python_interface + ale_python_interface
### Install Dependencies: ### Install Dependencies:
+ Install PaddlePaddle: + Install PaddlePaddle:
recommended to compile and install PaddlePaddle from source code recommended to compile and install PaddlePaddle from source code
+ Install other dependencies: + Install other dependencies:
``` ```
pip install -r requirement.txt pip install -r requirement.txt
pip install gym[atari] pip install gym[atari]
``` ```
Install ale_python_interface, can reference:https://github.com/mgbellemare/Arcade-Learning-Environment Install ale_python_interface, can reference:https://github.com/mgbellemare/Arcade-Learning-Environment
### Start Training: ### Start Training:
``` ```
# To train a model for Pong game with gpu (use DQN model as default) # To train a model for Pong game with gpu (use DQN model as default)
python train.py --rom ./rom_files/pong.bin --use_cuda python train.py --rom ./rom_files/pong.bin --use_cuda
# To train a model for Pong with DoubleDQN # To train a model for Pong with DoubleDQN
python train.py --rom ./rom_files/pong.bin --use_cuda --alg DoubleDQN python train.py --rom ./rom_files/pong.bin --use_cuda --alg DoubleDQN
# To train a model for Pong with DuelingDQN # To train a model for Pong with DuelingDQN
python train.py --rom ./rom_files/pong.bin --use_cuda --alg DuelingDQN python train.py --rom ./rom_files/pong.bin --use_cuda --alg DuelingDQN
``` ```
To train more games, can install more rom files from [here](https://github.com/openai/atari-py/tree/master/atari_py/atari_roms) To train more games, can install more rom files from [here](https://github.com/openai/atari-py/tree/master/atari_py/atari_roms)
### Start Testing: ### Start Testing:
``` ```
# Play the game with saved best model and calculate the average rewards # Play the game with saved best model and calculate the average rewards
python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong
# Play the game with visualization # Play the game with visualization
python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong --viz 0.01 python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong --viz 0.01
``` ```
...@@ -15,43 +15,43 @@ ...@@ -15,43 +15,43 @@
# 使用教程 # 使用教程
### 依赖: ### 依赖:
+ python2.7 + python2.7
+ gym + gym
+ tqdm + tqdm
+ opencv-python + opencv-python
+ paddlepaddle-gpu>=0.12.0 + paddlepaddle-gpu>=0.12.0
+ ale_python_interface + ale_python_interface
### 下载依赖: ### 下载依赖:
+ 安装PaddlePaddle: + 安装PaddlePaddle:
建议通过PaddlePaddle源码进行编译安装 建议通过PaddlePaddle源码进行编译安装
+ 下载其它依赖: + 下载其它依赖:
``` ```
pip install -r requirement.txt pip install -r requirement.txt
pip install gym[atari] pip install gym[atari]
``` ```
安装ale_python_interface可以参考:https://github.com/mgbellemare/Arcade-Learning-Environment 安装ale_python_interface可以参考:https://github.com/mgbellemare/Arcade-Learning-Environment
### 训练模型: ### 训练模型:
``` ```
# 使用GPU训练Pong游戏(默认使用DQN模型) # 使用GPU训练Pong游戏(默认使用DQN模型)
python train.py --rom ./rom_files/pong.bin --use_cuda python train.py --rom ./rom_files/pong.bin --use_cuda
# 训练DoubleDQN模型 # 训练DoubleDQN模型
python train.py --rom ./rom_files/pong.bin --use_cuda --alg DoubleDQN python train.py --rom ./rom_files/pong.bin --use_cuda --alg DoubleDQN
# 训练DuelingDQN模型 # 训练DuelingDQN模型
python train.py --rom ./rom_files/pong.bin --use_cuda --alg DuelingDQN python train.py --rom ./rom_files/pong.bin --use_cuda --alg DuelingDQN
``` ```
训练更多游戏,可以下载游戏rom从[这里](https://github.com/openai/atari-py/tree/master/atari_py/atari_roms) 训练更多游戏,可以下载游戏rom从[这里](https://github.com/openai/atari-py/tree/master/atari_py/atari_roms)
### 测试模型: ### 测试模型:
``` ```
# Play the game with saved model and calculate the average rewards # Play the game with saved model and calculate the average rewards
# 使用训练过程中保存的最好模型玩游戏,以及计算平均奖励(rewards) # 使用训练过程中保存的最好模型玩游戏,以及计算平均奖励(rewards)
python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong
# 以可视化的形式来玩游戏 # 以可视化的形式来玩游戏
python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong --viz 0.01 python play.py --rom ./rom_files/pong.bin --use_cuda --model_path ./saved_model/DQN-pong --viz 0.01
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册