Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit b50f44f

Browse files
committed
Initial commit
0 parents  commit b50f44f

29 files changed

+4926
-0
lines changed

CODE_OF_CONDUCT.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
4+
Please read the [full text](https://code.fb.com/codeofconduct/)
5+
so that you can understand what actions will and will not be tolerated.

CONTRIBUTING.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Contributing to Impact-Driven-Exploration
2+
We want to make contributing to this project as easy and transparent as
3+
possible.
4+
5+
## Pull Requests
6+
We actively welcome your pull requests.
7+
8+
1. Fork the repo and create your branch from `master`.
9+
2. If you've added code that should be tested, add tests.
10+
3. If you've changed APIs, update the documentation.
11+
4. If you haven't already, complete the Contributor License Agreement ("CLA").
12+
13+
## Contributor License Agreement ("CLA")
14+
In order to accept your pull request, we need you to submit a CLA. You only need
15+
to do this once to work on any of Facebook's open source projects.
16+
17+
Complete your CLA here: <https://code.facebook.com/cla>
18+
19+
## Issues
20+
We use GitHub issues to track public bugs. Please ensure your description is
21+
clear and has sufficient instructions to be able to reproduce the issue.
22+
23+
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
24+
disclosure of security bugs. In those cases, please go through the process
25+
outlined on that page and do not file a public issue.
26+
27+
## License
28+
By contributing to Impact-Driven-Exploration, you agree that your contributions will be licensed
29+
under the LICENSE file in the root directory of this source tree.

LICENSE

+399
Large diffs are not rendered by default.

README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# RIDE: Rewarding Impact-Driven Exploration for Procedurally-Generated Environments
2+
3+
This is an implementation of the method proposed in <a href="https://openreview.net/pdf?id=rkg-TJBFPB">RIDE: Rewarding Impact-Driven Exploration for Procedurally-Generated Environments</a>, which was published at ICLR 2020. The code includes all the baselines and ablations used in the paper.
4+
5+
We propose a novel type of intrinsic reward which encourges the agent to take actions that result in significant changes to its representation of the environment state.
6+
7+
## Installation
8+
9+
```
10+
# create a new conda environment
11+
conda create -n ride-env python=3.6.8
12+
conda activate ride-env
13+
14+
# install PyTorch
15+
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
16+
17+
# install other requirements
18+
git clone [email protected]:fairinternal/impact-driven-exploration.git
19+
cd impact-driven-exploration
20+
pip install -r requirements.txt
21+
22+
# install the MiniGrid environments
23+
cd impact-driven-exploration
24+
git clone https://github.com/maximecb/gym-minigrid.git
25+
cd gym-minigrid
26+
pip install -e .
27+
```
28+
29+
## Train RIDE on MiniGrid
30+
```
31+
cd impact-driven-exploration
32+
33+
OMP_NUM_THREADS=1 python main.py --model ride --env MiniGrid-MultiRoom-N12-S10-v0
34+
35+
OMP_NUM_THREADS=1 python main.py --model ride --env MiniGrid-MultiRoom-N10-S4-v0 --intrinsic_reward_coef 0.1 --entropy_cost 0.0005
36+
```
37+
38+
## Acknowledgements
39+
Our vanilla RL algorithm is based on [Torchbesat](https://github.com/facebookresearch/torchbeast), which is an open source implementation of IMPALA.
40+
41+
## License
42+
This code is under the CC-BY-NC 4.0 (Attribution-NonCommercial 4.0 International) license.

__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
# All rights reserved.
3+
4+
# This source code is licensed under the license found in the
5+
# LICENSE file in the root directory of this source tree.

main.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
# All rights reserved.
3+
4+
# This source code is licensed under the license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
from src.arguments import parser
8+
9+
from src.algos.torchbeast import train as train_vanilla
10+
from src.algos.count import train as train_count
11+
from src.algos.curiosity import train as train_curiosity
12+
from src.algos.rnd import train as train_rnd
13+
from src.algos.ride import train as train_ride
14+
from src.algos.no_episodic_counts import train as train_no_episodic_counts
15+
from src.algos.only_episodic_counts import train as train_only_episodic_counts
16+
17+
def main(flags):
18+
if flags.model == 'vanilla':
19+
train_vanilla(flags)
20+
elif flags.model == 'count':
21+
train_count(flags)
22+
elif flags.model == 'curiosity':
23+
train_curiosity(flags)
24+
elif flags.model == 'rnd':
25+
train_rnd(flags)
26+
elif flags.model == 'ride':
27+
train_ride(flags)
28+
elif flags.model == 'no-episodic-counts':
29+
train_no_episodic_counts(flags)
30+
elif flags.model == 'only-episodic-counts':
31+
train_only_episodic_counts(flags)
32+
else:
33+
raise NotImplementedError("This model has not been implemented. "\
34+
"The available options are: vanilla, count, curiosity, rnd, ride, \
35+
no-episodic-counts, and only-episodic-count.")
36+
37+
if __name__ == '__main__':
38+
flags = parser.parse_args()
39+
main(flags)

requirements.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
certifi==2019.11.28
2+
cffi==1.13.2
3+
cloudpickle==1.2.2
4+
future==0.18.2
5+
gitdb2==2.0.6
6+
GitPython==3.0.5
7+
gym==0.15.4
8+
gym-super-mario-bros==7.3.0
9+
mkl-fft==1.0.15
10+
mkl-random==1.1.0
11+
mkl-service==2.3.0
12+
nes-py==8.1.1
13+
numpy==1.17.4
14+
olefile==0.46
15+
opencv-python==4.1.2.30
16+
Pillow==6.2.1
17+
pycparser==2.19
18+
pyglet==1.3.2
19+
PyQt5==5.13.2
20+
PyQt5-sip==12.7.0
21+
scipy==1.3.3
22+
six==1.13.0
23+
smmap2==2.0.5
24+
torch==1.1.0
25+
torchvision==0.3.0
26+
tqdm==4.40.2
27+
vizdoom==1.1.7

src/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
# All rights reserved.
3+
4+
# This source code is licensed under the license found in the
5+
# LICENSE file in the root directory of this source tree.

src/algos/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
# All rights reserved.
3+
4+
# This source code is licensed under the license found in the
5+
# LICENSE file in the root directory of this source tree.

0 commit comments

Comments
 (0)