Skip to content

Merge Dev/jan into experimental #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 78 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
45500ce
added log level command line arg
vonHartz May 18, 2021
8f18596
testing poetry
vonHartz May 26, 2021
1cdaa6a
playing with toml
vonHartz May 26, 2021
628ab31
mutex problem
vonHartz May 26, 2021
ba13f35
fixed mutex extras
vonHartz May 26, 2021
d8a58c3
version bump for pypi test
vonHartz May 26, 2021
730d2a0
added status badges
vonHartz May 26, 2021
d242a93
rebuild docs
vonHartz May 26, 2021
f74537b
rebuild docs
vonHartz May 26, 2021
c804624
added build docs to git for subtree use
vonHartz May 26, 2021
9b09064
updated doc
vonHartz May 26, 2021
cdb34be
added nojekyll
vonHartz May 26, 2021
0ccd74d
fixed command
vonHartz May 26, 2021
9926e40
fixed cov link
vonHartz May 26, 2021
1e1ad4a
added workflows from master
vonHartz May 26, 2021
6fdc196
added missing build command
vonHartz May 26, 2021
462df3d
bumped versions for deploy test, moved tests
vonHartz May 26, 2021
183f803
fixed typo
vonHartz May 26, 2021
4749c21
mujoco installation
vonHartz May 26, 2021
ed0bc10
debug mujoco install
vonHartz May 26, 2021
3c861be
debug mujoco install
vonHartz May 26, 2021
76571b9
added pypi isntall instructions, entry point (NOT FUNCTIONAL YET)
vonHartz May 28, 2021
9b2837f
skip test, publish only when creating release
vonHartz May 28, 2021
f6f5e08
added author
vonHartz May 28, 2021
6fe8ace
rm mujoco installation
vonHartz May 28, 2021
b9ad471
merged experimental into dev/jan
vonHartz May 30, 2021
1663b8f
created main function
vonHartz May 30, 2021
6b6cc90
ensured prev_reward is always defined
vonHartz May 30, 2021
237c33f
another test commit to testpypi for testing installation via pip
vonHartz May 30, 2021
793b744
reset build and release condition
vonHartz May 30, 2021
deb866c
renamed test workflow, added pypi installation test flow
vonHartz May 30, 2021
012ea3c
removed ununsed packages"
vonHartz May 30, 2021
115c6a5
ray installation fixed
vonHartz May 30, 2021
4ddf94f
added entry point to pyproject for poetry
vonHartz May 30, 2021
bca0ccc
version bump, deploy for pypi test
vonHartz May 30, 2021
d085e44
reset trigger condition
vonHartz May 30, 2021
77df7a2
typo
vonHartz May 30, 2021
c25e69b
generated lock file
vonHartz May 30, 2021
22a4939
added init to find run_exp
vonHartz May 30, 2021
cd5cca4
reset trigger condition
vonHartz May 30, 2021
030b78b
synced setup: updated urls, copied packages from poetry build
vonHartz May 30, 2021
3ca5af3
moved scripts around to fix entry point
vonHartz May 30, 2021
94ce46d
version bump for pypi test
vonHartz May 30, 2021
4c475cd
reset trigger condition
vonHartz May 30, 2021
070792c
added cov to worklfow, fixed test for new script dir
vonHartz May 30, 2021
a6cc098
allow to call main with args in other python scripts
vonHartz May 30, 2021
19e18d8
moved scripts to top level, adapted setups
vonHartz Jun 4, 2021
032ef4b
Merge branch 'experimental' into dev/jan
vonHartz Jun 4, 2021
2d2104a
Revert "moved scripts to top level, adapted setups"
vonHartz Jun 4, 2021
57e9d45
removed redundant import
vonHartz Jun 4, 2021
651b5ac
reapplied cli change
vonHartz Jun 4, 2021
a312d22
reapplied cli entry point
vonHartz Jun 4, 2021
55a0250
set version for pypi
vonHartz Jun 4, 2021
47c8e68
updated workflows for release prp, fixed old arg, made comment more s…
vonHartz Jun 4, 2021
b4726ac
unified ray init that is version agnostic
vonHartz Jun 4, 2021
48878f0
updated readmes
vonHartz Jun 4, 2021
03ce4d6
removed other scripts for test
vonHartz Jun 4, 2021
9ea98eb
deps defined in setup.py, so use this to install
vonHartz Jun 4, 2021
eafe368
need np for configspace
vonHartz Jun 4, 2021
d4c8aea
need np for configspace
vonHartz Jun 4, 2021
f52ac34
fixed gcc version, updated scipy version, added numpy to build reqs"
vonHartz Jun 4, 2021
e905008
install setuptools, not np
vonHartz Jun 4, 2021
caf519d
added setup requirement
vonHartz Jun 4, 2021
ad5373a
need manual numpy install
vonHartz Jun 4, 2021
2e6f42e
moved to toml
vonHartz Jun 4, 2021
0457d34
auto-install doesnt work
vonHartz Jun 4, 2021
35977ca
added ray extras"
vonHartz Jun 4, 2021
43a8516
used ray 0.9 for test due to beta_annealing_factor being depreceated
vonHartz Jun 4, 2021
2740bd0
dont use mujoco in tests
vonHartz Jun 4, 2021
6ec6be1
manual tf install, fixed tmp_dir arg for ray 0.x
vonHartz Jun 4, 2021
611b815
updated authors
vonHartz Jun 4, 2021
d01b9d1
rebuild docs
vonHartz Jun 4, 2021
24618cf
gym version
vonHartz Jun 4, 2021
3e83971
ray versions for test
vonHartz Jun 4, 2021
98f04cf
updated ray version
vonHartz Jun 4, 2021
337e497
typo
vonHartz Jun 4, 2021
af56610
updated dep for test
vonHartz Jun 4, 2021
400ac6e
install atari
vonHartz Jun 4, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/gh-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches: [ master, dev/jan ]
pull_request:
branches: [ master, dev/jan ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov setuptools numpy
pip install -e .[extras_disc]
pip install ray[rllib,debug]==0.7.3
pip install tensorflow==1.13.0rc1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --statistics
- name: Test with pytest
run: |
pytest tests
- name: Cov report
run: |
pytest --cov=./ --cov-report=xml tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
31 changes: 31 additions & 0 deletions .github/workflows/install-from-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test PyPI Installation

on:
push:
branches: [ master, dev/jan ]
pull_request:
branches: [ master, dev/jan ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tensorflow==2.2.0
wget 'https://ray-wheels.s3-us-west-2.amazonaws.com/master/8d0c1b5e068853bf748f72b1e60ec99d240932c6/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl'
pip install ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl[rllib,debug]
- name: Install from PyPI
run: |
pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple mdp-playground
- name: Basic functionality test
run: |
run-mdpp-experiments --help
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Publish

on:
release:
types:
- 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

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.6"
- name: Install Poetry
run: |
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
python get-poetry.py -y
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v1
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- name: Install dependencies
run: poetry install --no-interaction
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build -r pypi
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ instance/
# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

Expand Down
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Contributing

## Developer Installation

For development, manual installation is the easiest way to stay up-to-date:
```bash
pip install -e .[extras]
```

In addition to the standard dependencies, please install the following:
```bash
pip install sphinx, sphinx-book-theme # for generating documentation
pip install pytest-cov # for coverage report
# install poetry for packaging and publishing to PyPI
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
```

## Packaging

The `pyproject.toml` is set up using `poetry`.

Build via `poetry build`, and publish via `poetry publish`. There are automatic workflows in place to build and publish on new package revisions.

To enable manual installation with `poetry`, we also include a `setup.py` which needs to be kept up-to-date.


## Docs

The documentation can be built using sphinx via:
```bash
cd docs
make html
```

To clean up:
```bash
make clean
rm -rf _autosummary # optional
```

To publish:
```bash
git subtree push --prefix docs/_build/html/ origin gh-pages
```
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<p align="center">

<a href="https://github.com/automl/mdp-playground/actions/workflows/gh-test.yml" target="_blank">
<img src="https://github.com/automl/mdp-playground/actions/workflows/gh-test.yml/badge.svg" alt="Test">
</a>
<a href="https://github.com/automl/mdp-playground/actions/workflows/publish.yml" target="_blank">
<img src="https://github.com/automl/mdp-playground/actions/workflows/publish.yml/badge.svg" alt="Publish">
</a>
<a href="https://codecov.io/gh/automl/mdp-playground" target="_blank">
<img src="https://img.shields.io/codecov/c/github/automl/mdp-playground?color=%2334D058" alt="Coverage">
</a>
<a href="https://pypi.org/project/mdp-playground/" target="_blank">
<img src="https://img.shields.io/pypi/v/mdp-playground?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://pypi.org/project/mdp-playground/" target="_blank">
<img src="https://img.shields.io/pypi/pyversions/mdp-playground.svg" alt="Python Versions">
</a>
</p>


# MDP Playground
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.

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

## Installation

### Production use
We recommend using `conda` to manage environments. After setup of the environment, you can install MDP Playground in two ways:
#### Manual
To install MDP Playground manually, clone the repository and run:
```bash
pip install -e .[extras]
```
This might be the preferred way if you want easy access to the included experiments.

#### From PyPI
MDP Playground is also on PyPI. Just run:
```bash
pip install mdp_playground[extras]
```


### Reproducing results from the paper
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.

Please follow the following commands to install for the discrete toy experiments:
```
```bash
conda create -n py36_toy_rl_disc_toy python=3.6
conda activate py36_toy_rl_disc_toy
cd mdp-playground
pip install -e .[extras_disc]
```

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

You can run experiments using:
```
python run_experiments.py -c <config_file> -e <exp_name> -n <config_num>
run-mdpp-experiments -c <config_file> -e <exp_name> -n <config_num>
```
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>
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.)
Expand All @@ -53,7 +91,7 @@ For example, for algorithm **DQN** when varying dimensions **delay** and **seque

## Running experiments from the main paper
We list here the commands for the experiments from the main paper:
```
```bash
# Discrete toy environments:
# Image representation experiments:
conda activate py36_toy_rl_disc_toy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mdp\_playground.analysis.analysis.MDPP\_Analysis
mdp\_playground.analysis.analysis.MDPP\_Analysis
================================================

.. currentmodule:: mdp_playground.analysis.analysis
Expand Down
2 changes: 1 addition & 1 deletion docs/_autosummary/mdp_playground.analysis.analysis.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mdp\_playground.analysis.analysis
mdp\_playground.analysis.analysis
=================================

.. automodule:: mdp_playground.analysis.analysis
Expand Down
73 changes: 0 additions & 73 deletions docs/_autosummary/mdp_playground.analysis.radar_chart.Affine2D.rst

This file was deleted.

Loading