Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Commit

Permalink
multi-input models & tensorflow 2 keras support
Browse files Browse the repository at this point in the history
  • Loading branch information
inarikami committed May 21, 2019
1 parent cf0a9db commit b60818b
Show file tree
Hide file tree
Showing 81 changed files with 6,499 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.DS_Store
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributing to Keras-RL

New contributors are very welcomed! If you're interested, please post a message on the [Discord](https://discord.gg/FfRgSU).

Here is a list of ways you can contribute to this repository:
- Tackle an open issue on [Github](https://github.com/wau/keras-rl2/issues)
- Improve documentation
- Improve test coverage
- Add examples
- Implement new algorithms on Keras-RL (please get in touch on Gitter)
- Link to your personal projects built on top of Keras-RL


## How to run the tests

To run the tests locally, you'll first have to install the following dependencies:
```bash
pip install pytest pytest-xdist pep8 pytest-pep8 pytest-cov python-coveralls
```
You can then run all tests using this command:
```bash
py.test tests/.
```
If you want to check if the files conform to the PEP8 style guidelines, run the following command:
```bash
py.test --pep8
```
11 changes: 11 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question in the [Discord](https://discord.gg/FfRgSU).

Thank you!

- [ ] Check that you are up-to-date with the master branch of Keras-RL. You can update with:
`pip install git+git://github.com/wau/keras-rl2.git --upgrade --no-deps`

- [ ] Check that you are up-to-date with the master branch of Keras. You can update with:
`pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps`

- [ ] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short). If you report an error, please include the error message and the backtrace.
4 changes: 2 additions & 2 deletions LICENSE
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 wau
Copyright (c) 2019 Taylor McNally

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
111 changes: 110 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,110 @@
# keras-rl2
<p align="center">
<img src="./assets/kerasrl2g.png" width="535" height="201" />
<br>
<a>
<img src="https://img.shields.io/badge/python-3.7+-blue.svg" alt="Gitter">
</a>
<a>
<img src="https://camo.githubusercontent.com/7ce7d8e78ad8ddab3bea83bb9b98128528bae110/68747470733a2f2f616c65656e34322e6769746875622e696f2f6261646765732f7372632f74656e736f72666c6f772e737667" alt="Gitter">
</a>
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Gitter">
</a>
<a href="http://keras-rl2.readthedocs.io/">
<img src="https://readthedocs.org/projects/keras-rl/badge/" alt="Gitter">
</a>
<a href="https://discord.gg/FfRgSU">
<img src="https://img.shields.io/discord/308323056592486420.svg?logo=slack" alt="Gitter">
</a>
<h3 align="center">Deep Reinforcement Learning for Tensorflow 2 Keras</h3></p>


<table>
<tr>
<td><img src="/assets/breakout.gif?raw=true" width="200"></td>
<td><img src="/assets/cartpole.gif?raw=true" width="200"></td>
<td><img src="/assets/pendulum.gif?raw=true" width="200"></td>
</tr>
</table>

### NOTE: Use the latest commit from the master branch of https://github.com/tensorflow/tensorflow. The lastest release does not include needed fixes.


## What is it?

`keras-rl2` implements some state-of-the art deep reinforcement learning algorithms in Python and seamlessly integrates with the deep learning library [Keras](http://keras.io).

Furthermore, `keras-rl2` works with [OpenAI Gym](https://gym.openai.com/) out of the box. This means that evaluating and playing around with different algorithms is easy.

Of course you can extend `keras-rl2` according to your own needs. You can use built-in Keras callbacks and metrics or define your own.
Even more so, it is easy to implement your own environments and even algorithms by simply extending some simple abstract classes. Documentation is available [online](http://keras-rl2.readthedocs.org).


## What is included?
As of today, the following algorithms have been implemented:

- [x] Deep Q Learning (DQN) [[1]](http://arxiv.org/abs/1312.5602), [[2]](https://www.nature.com/articles/nature14236)
- [x] Double DQN [[3]](http://arxiv.org/abs/1509.06461)
- [x] Deep Deterministic Policy Gradient (DDPG) [[4]](http://arxiv.org/abs/1509.02971)
- [x] Continuous DQN (CDQN or NAF) [[6]](http://arxiv.org/abs/1603.00748)
- [x] Cross-Entropy Method (CEM) [[7]](http://learning.mpi-sws.org/mlss2016/slides/2016-MLSS-RL.pdf), [[8]](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.81.6579&rep=rep1&type=pdf)
- [x] Dueling network DQN (Dueling DQN) [[9]](https://arxiv.org/abs/1511.06581)
- [x] Deep SARSA [[10]](http://people.inf.elte.hu/lorincz/Files/RL_2006/SuttonBook.pdf)
- [ ] Asynchronous Advantage Actor-Critic (A3C) [[5]](http://arxiv.org/abs/1602.01783)
- [ ] Proximal Policy Optimization Algorithms (PPO) [[11]](https://arxiv.org/abs/1707.06347)

You can find more information on each agent in the [doc](http://keras-rl.readthedocs.io/en/latest/agents/overview/).


## Installation

- Install Keras-RL2 from Pypi (recommended):

```
pip install keras-rl2
```

- Install from Github source:

```
git clone https://github.com/keras-rl2/keras-rl2.git
cd keras-rl
python setup.py install
```

## Examples

If you want to run the examples, you'll also have to install:
- **gym** by OpenAI: [Installation instruction](https://github.com/openai/gym#installation)
- **h5py**: simply run `pip install h5py`

For atari example you will also need:
- **Pillow**: `pip install Pillow`
- **gym[atari]**: Atari module for gym. Use `pip install gym[atari]`

Once you have installed everything, you can try out a simple example:
```bash
python examples/dqn_cartpole.py
```
This is a very simple example and it should converge relatively quickly, so it's a great way to get started!
It also visualizes the game during training, so you can watch it learn. How cool is that?



If you have questions or problems, please file an issue or, even better, fix the problem yourself and submit a pull request!



## References

1. *Playing Atari with Deep Reinforcement Learning*, Mnih et al., 2013
2. *Human-level control through deep reinforcement learning*, Mnih et al., 2015
3. *Deep Reinforcement Learning with Double Q-learning*, van Hasselt et al., 2015
4. *Continuous control with deep reinforcement learning*, Lillicrap et al., 2015
5. *Asynchronous Methods for Deep Reinforcement Learning*, Mnih et al., 2016
6. *Continuous Deep Q-Learning with Model-based Acceleration*, Gu et al., 2016
7. *Learning Tetris Using the Noisy Cross-Entropy Method*, Szita et al., 2006
8. *Deep Reinforcement Learning (MLSS lecture notes)*, Schulman, 2016
9. *Dueling Network Architectures for Deep Reinforcement Learning*, Wang et al., 2016
10. *Reinforcement learning: An introduction*, Sutton and Barto, 2011
11. *Proximal Policy Optimization Algorithms*, Schulman et al., 2017
Binary file added assets/breakout.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cartpole.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kerasrl2g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pendulum.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b60818b

Please sign in to comment.