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.
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:
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.
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
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Send me a message at: https://www.linkedin.com/in/gustavobruno-developer/