Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.18 KB

README.md

File metadata and controls

51 lines (35 loc) · 1.18 KB

Reinforced pong using Deep Q-Net

I created this repo to play around with the Deep Q-Network algorithm.

Getting started

Make a virtual environment so that you don't mess up the system installations and install the dependencies. These are opencv-python torch and pygame. Use python3.6.

virtualenv -p /usr/bin/python3.6 venv
source venv/bin/activate
pip install -r requirements.txt

Test

I trained the model on 4 mil epochs. This took ~6h on my GTX-1070. If you wish to test my model simply type:

python dqn.py test current_model_4000000.pth

On the RHS the paddle changes position by tracking the y-position of the ball. Conversely, on the LHS the paddle changes it's position according to the action predicted by the DQN algorithm.

Train

Should you want to train your own model, just type the command:

python dqn.py train

Every 25000 epochs a checkpoint is saved in the pretrained_model directory.

Continue training

python dqn.py continue <name_of_checkpoint>

For example:

python dqn.py continue current_model_4000000.pth