Skip to content

Commit 02ff4f7

Browse files
authored
Merge pull request #4 from automl/dev/jan
Merge Dev/jan into experimental
2 parents a901d16 + 400ac6e commit 02ff4f7

File tree

275 files changed

+75506
-3589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+75506
-3589
lines changed

‎.github/workflows/gh-test.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Test
5+
6+
on:
7+
push:
8+
branches: [ master, dev/jan ]
9+
pull_request:
10+
branches: [ master, dev/jan ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python 3.6
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.6
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install flake8 pytest pytest-cov setuptools numpy
27+
pip install -e .[extras_disc]
28+
pip install ray[rllib,debug]==0.7.3
29+
pip install tensorflow==1.13.0rc1
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings.
35+
flake8 . --count --exit-zero --statistics
36+
- name: Test with pytest
37+
run: |
38+
pytest tests
39+
- name: Cov report
40+
run: |
41+
pytest --cov=./ --cov-report=xml tests
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v1
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}
46+
files: ./coverage.xml
47+
directory: ./coverage/reports/
48+
flags: unittests
49+
env_vars: OS,PYTHON
50+
name: codecov-umbrella
51+
fail_ci_if_error: true
52+
path_to_write_report: ./coverage/codecov_report.txt
53+
verbose: true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test PyPI Installation
2+
3+
on:
4+
push:
5+
branches: [ master, dev/jan ]
6+
pull_request:
7+
branches: [ master, dev/jan ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python 3.6
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.6
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install tensorflow==2.2.0
24+
wget 'https://ray-wheels.s3-us-west-2.amazonaws.com/master/8d0c1b5e068853bf748f72b1e60ec99d240932c6/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl'
25+
pip install ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl[rllib,debug]
26+
- name: Install from PyPI
27+
run: |
28+
pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple mdp-playground
29+
- name: Basic functionality test
30+
run: |
31+
run-mdpp-experiments --help

‎.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Publish
2+
3+
on:
4+
release:
5+
types:
6+
- created # see https://docs.github.com/en/rest/reference/repos#create-a-release and https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Python
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: "3.6"
17+
- name: Install Poetry
18+
run: |
19+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
20+
python get-poetry.py -y
21+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
22+
- name: Configure poetry
23+
run: poetry config virtualenvs.in-project true
24+
- name: Set up cache
25+
uses: actions/cache@v1
26+
id: cache
27+
with:
28+
path: .venv
29+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
30+
- name: Ensure cache is healthy
31+
if: steps.cache.outputs.cache-hit == 'true'
32+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
33+
- name: Install dependencies
34+
run: poetry install --no-interaction
35+
- name: Publish
36+
env:
37+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
38+
run: |
39+
poetry config pypi-token.pypi $PYPI_TOKEN
40+
poetry publish --build -r pypi

‎.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ instance/
6767
# Scrapy stuff:
6868
.scrapy
6969

70-
# Sphinx documentation
71-
docs/_build/
72-
7370
# PyBuilder
7471
target/
7572

‎CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing
2+
3+
## Developer Installation
4+
5+
For development, manual installation is the easiest way to stay up-to-date:
6+
```bash
7+
pip install -e .[extras]
8+
```
9+
10+
In addition to the standard dependencies, please install the following:
11+
```bash
12+
pip install sphinx, sphinx-book-theme # for generating documentation
13+
pip install pytest-cov # for coverage report
14+
# install poetry for packaging and publishing to PyPI
15+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
16+
```
17+
18+
## Packaging
19+
20+
The `pyproject.toml` is set up using `poetry`.
21+
22+
Build via `poetry build`, and publish via `poetry publish`. There are automatic workflows in place to build and publish on new package revisions.
23+
24+
To enable manual installation with `poetry`, we also include a `setup.py` which needs to be kept up-to-date.
25+
26+
27+
## Docs
28+
29+
The documentation can be built using sphinx via:
30+
```bash
31+
cd docs
32+
make html
33+
```
34+
35+
To clean up:
36+
```bash
37+
make clean
38+
rm -rf _autosummary # optional
39+
```
40+
41+
To publish:
42+
```bash
43+
git subtree push --prefix docs/_build/html/ origin gh-pages
44+
```

‎README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<p align="center">
2+
3+
<a href="https://github.com/automl/mdp-playground/actions/workflows/gh-test.yml" target="_blank">
4+
<img src="https://github.com/automl/mdp-playground/actions/workflows/gh-test.yml/badge.svg" alt="Test">
5+
</a>
6+
<a href="https://github.com/automl/mdp-playground/actions/workflows/publish.yml" target="_blank">
7+
<img src="https://github.com/automl/mdp-playground/actions/workflows/publish.yml/badge.svg" alt="Publish">
8+
</a>
9+
<a href="https://codecov.io/gh/automl/mdp-playground" target="_blank">
10+
<img src="https://img.shields.io/codecov/c/github/automl/mdp-playground?color=%2334D058" alt="Coverage">
11+
</a>
12+
<a href="https://pypi.org/project/mdp-playground/" target="_blank">
13+
<img src="https://img.shields.io/pypi/v/mdp-playground?color=%2334D058&label=pypi%20package" alt="Package version">
14+
</a>
15+
<a href="https://pypi.org/project/mdp-playground/" target="_blank">
16+
<img src="https://img.shields.io/pypi/pyversions/mdp-playground.svg" alt="Python Versions">
17+
</a>
18+
</p>
19+
20+
121
# MDP Playground
222
A python package to inject low-level dimensions of difficulties in RL environments. There are toy environments to design and debug RL agents. And complex environment wrappers for Atari and Mujoco to test robustness to these dimensions in complex environments.
323

@@ -12,18 +32,36 @@ There are 4 parts to the package:
1232
4) **Analysis**: [`plot_experiments.ipynb`](plot_experiments.ipynb) contains code to plot the standard plots from the paper.
1333

1434
## Installation
35+
36+
### Production use
37+
We recommend using `conda` to manage environments. After setup of the environment, you can install MDP Playground in two ways:
38+
#### Manual
39+
To install MDP Playground manually, clone the repository and run:
40+
```bash
41+
pip install -e .[extras]
42+
```
43+
This might be the preferred way if you want easy access to the included experiments.
44+
45+
#### From PyPI
46+
MDP Playground is also on PyPI. Just run:
47+
```bash
48+
pip install mdp_playground[extras]
49+
```
50+
51+
52+
### Reproducing results from the paper
1553
We recommend using `conda` environments to manage virtual `Python` environments to run the experiments. Unfortunately, you will have to maintain 2 environments - 1 for the "older" **discrete toy** experiments and 1 for the "newer" **continuous and complex** experiments from the paper. As mentioned in Appendix P in the paper, this is because of issues with Ray, the library that we used for our baseline agents.
1654

1755
Please follow the following commands to install for the discrete toy experiments:
18-
```
56+
```bash
1957
conda create -n py36_toy_rl_disc_toy python=3.6
2058
conda activate py36_toy_rl_disc_toy
2159
cd mdp-playground
2260
pip install -e .[extras_disc]
2361
```
2462

2563
Please follow the following commands to install for the continuous and complex experiments:
26-
```
64+
```bash
2765
conda create -n py36_toy_rl_cont_comp python=3.6
2866
conda activate py36_toy_rl_cont_comp
2967
cd mdp-playground
@@ -39,7 +77,7 @@ For general instructions, please continue reading.
3977

4078
You can run experiments using:
4179
```
42-
python run_experiments.py -c <config_file> -e <exp_name> -n <config_num>
80+
run-mdpp-experiments -c <config_file> -e <exp_name> -n <config_num>
4381
```
4482
The `exp_name` is a prefix for the filenames of CSV files where stats for the experiments are recorded. The CSV stats files will be saved to the current directory.<br>
4583
Each of the command line arguments has defaults. Please refer to the documentation inside [`run_experiments.py`](run_experiments.py) for further details on the command line arguments. (Or run it with the `-h` flag to bring up help.)
@@ -53,7 +91,7 @@ For example, for algorithm **DQN** when varying dimensions **delay** and **seque
5391

5492
## Running experiments from the main paper
5593
We list here the commands for the experiments from the main paper:
56-
```
94+
```bash
5795
# Discrete toy environments:
5896
# Image representation experiments:
5997
conda activate py36_toy_rl_disc_toy

‎docs/_autosummary/mdp_playground.analysis.analysis.MDPP_Analysis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mdp\_playground.analysis.analysis.MDPP\_Analysis
1+
mdp\_playground.analysis.analysis.MDPP\_Analysis
22
================================================
33

44
.. currentmodule:: mdp_playground.analysis.analysis

‎docs/_autosummary/mdp_playground.analysis.analysis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mdp\_playground.analysis.analysis
1+
mdp\_playground.analysis.analysis
22
=================================
33

44
.. automodule:: mdp_playground.analysis.analysis

‎docs/_autosummary/mdp_playground.analysis.radar_chart.Affine2D.rst

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)