GitXplorerGitXplorer
g

dqn_mountain_car

public
3 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
a05daceb457f694229da995757e89656ab2064ad

Add: Gif Creation

committed 4 years ago
Unverified
773cfca264fb6f86f99eb5c3d232ebdfd8553a87

Fixed outdated test

committed 4 years ago
Unverified
402a4533d85fd06fb63a2d476f4201362f35db76

Add: argparser for the model name in both train.py and show_model_playing.py

committed 4 years ago
Unverified
3a829200db32cd17d2051576dbf18f85af446f75

Add: Show model playing

committed 4 years ago
Unverified
073df72d6b50d0bc7a04c2cdae380b79678e90d8

Fix imports to run according to 'python -m' instead of 'python file.py'

committed 4 years ago
Unverified
877f8e19087d242810da26cdb0e9cf7268956dca

Sucessful Model Created

committed 4 years ago

README

The README file for this repository.

DQN Model Playing The Mountain Car Game

Gif Of Model after being trained for 1 million frames

Introduction

In this project, I created a Deep Q-Learning that reaches the goal of the Mountain Car Game. It trained for 1 million steps and reached the result you see above.

Installation

These steps helps you install OpenAi Gym in a Windows Environment. If this isn't your case, you can follow a similar approach suited to your OS.

These steps are based on this tutorial

Install Microsoft Visual C++ Build Tools for Visual Studio 2019 here:

Screenshot showing here to download the Build Tools for Visual Studio 2019

Using conda, create an env.

conda create -n env_name python=3.8 pip
conda activate env_name

Then, install the necessary packages:

Minimum install of OpenAI Gym:

pip install gym

Package to run the ToyText Environments:

conda install pystan

To run the Atari environments:

pip install -f https://github.com/Kojoley/atari-py/releases atari_py

To run the Box2D environments:

conda install swig
pip install Box2D

To generate the .gif files:

pip install moviepy

To run the tests:

pip install pytest

Install Pytorch here.

Install Xming to display your model playing the environments.

Usage

You can train a model, view a model in action, and generate a gif directly from the command-line:

Trains a model using the hyperparameters defined on src/config.py. You can also specify a model_name as an argument (should include the extension ".pt").

python -m src.train -model_name my_model.pt

View a model in action. You can specify the model_name (it should be one from the models folder). Must have Xming installed on your computer.

python -m src.show_model -model_name my_model.pt

Generate Gif. You can specify the model_name (it should be one from the models folder) and the name of the gif file (should include the extension ".gif").

python -m src.generate_gif -model_name my_model.pt -gif_name my_gif.gif

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Questions?

Send me a message at: https://www.linkedin.com/in/gustavobruno-developer/

License

MIT