Skip to content

Pytorch implementation of DQN, 1-step SARSA, REINFORCE, A2C, 1-step actor critic on Google Chrome dinosaur

Notifications You must be signed in to change notification settings

Lumotheninja/dino-reinforcement-learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pytorchasaurus Rex

Pytorch implementation of DQN, 1-step SARSA, REINFORCE, A2C, 1-step actor critic on Google Chrome dinosaur

dinosaur running

Installation

We recommend creating a virtualenv before installing the required packages. See virtualenv or virtualenv-wrapper on how to do so.

The dependencies can be easly installed using pip.

$ optional: open the virtualenv
$ pip install -r requirements.txt

Getting started

Webserver for running the javascript T-rex game

A simple webserver is required to run the T-rex javascript game. The easiest way to achieve this is by using python's Simple HTTP Server module.

Open a new terminal and navigate to TF-Rex/game, then run the following command

$ cd /path/to/project/TF-Rex/game
$ python3 -m http.server

The game is now accessable on your localhost 127.0.0.1:8000. This approach was tested for Chrome and Mozilla Firefox.

Tf-Rex

$ python test.py

This command will restore the pretrained model, stored in tf-rex/results and play the T-rex game, default is one step critic (our best model)

IMPORTANT: The browser needs to connect with the python side. Therefore, refresh the browser after firing the training/testing command.

Training a new model can be done as follow depending on the model that you want to train

$ python dqn.py
$ python a2c.py
$ python sarsa.py
$ python reinforce.py
$ python one_step_actor_critic.py

References

[1] The original TF-Rex
[2] Playing Atari with Deep Reinforcement Learning

About

Pytorch implementation of DQN, 1-step SARSA, REINFORCE, A2C, 1-step actor critic on Google Chrome dinosaur

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published