Skip to content

Commit

Permalink
Merge pull request #102 from automl/development
Browse files Browse the repository at this point in the history
Version 1.0.0
  • Loading branch information
TheEimer committed Aug 9, 2023
2 parents 90f3568 + 1834558 commit 9e6788c
Show file tree
Hide file tree
Showing 125 changed files with 4,475 additions and 4,355 deletions.
4 changes: 2 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ coverage:
# This encourages small PR's as they are easier to test.
patch:
default:
target: 90%
target: 10%
if_not_found: failure
if_ci_failed: error
if_ci_failed: failure

# We upload additional information on branching with pytest-cov `--cov-branch`
# This information can be used by codecov.com to increase analysis of code
Expand Down
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ extend-ignore =
E203
# No lambdas — too strict
E731
E722
F405
F403
12 changes: 9 additions & 3 deletions .github/workflows/dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ on:
- main
- development

# When a push occurs on a PR that targets these branches
# Trigger on open/push to a PR targeting one of these branches
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
- development

jobs:
dist:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest

steps:
Expand All @@ -38,7 +44,7 @@ jobs:
- name: Twine check
run: |
pip install twine
last_dist=$(ls -t dist/ContextuaRL-*.tar.gz | head -n 1)
last_dist=$(ls -t dist/carl-*.tar.gz | head -n 1)
twine_output=`twine check "$last_dist"`
if [[ "$twine_output" != "Checking $last_dist: PASSED" ]]
then
Expand All @@ -49,7 +55,7 @@ jobs:
- name: Install dist
run: |
last_dist=$(ls -t dist/ContextuaRL-*.tar.gz | head -n 1)
last_dist=$(ls -t dist/carl-*.tar.gz | head -n 1)
pip install $last_dist
- name: PEP 561 Compliance
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: docs

on:
# Manual trigger option in github
# This won't push to github pages where docs are hosted due
# to the gaurded if statement in those steps
workflow_dispatch:

# Trigger on push to these branches
push:
branches:
- main

# Trigger on a open/push to a PR targeting one of these branches
pull_request:
branches:
- main

env:
name: CARL

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install dependencies
run: |
pip install ".[docs]"
- name: Make docs
run: |
make clean
make doc
- name: Pull latest gh_pages
if: (contains(github.ref, 'version_0.2.0') || contains(github.ref, 'main')) && github.event_name == 'push'
run: |
cd ..
git clone https://github.com/${{ github.repository }}.git --branch gh_pages --single-branch gh_pages
- name: Copy new docs into gh_pages
if: (contains(github.ref, 'version_0.2.0') || contains(github.ref, 'main')) && github.event_name == 'push'
run: |
branch_name=${GITHUB_REF##*/}
cd ../gh_pages
rm -rf $branch_name
cp -r ../${{ env.name }}/docs/build/html $branch_name
- name: Push to gh_pages
if: (contains(github.ref, 'version_0.2.0') || contains(github.ref, 'main')) && github.event_name == 'push'
run: |
last_commit=$(git log --pretty=format:"%an: %s")
cd ../gh_pages
branch_name=${GITHUB_REF##*/}
git add $branch_name/
git config --global user.name 'Github Actions'
git config --global user.email 'not@mail.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "$last_commit"
git push
6 changes: 6 additions & 0 deletions .github/workflows/precommit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ on:

# When a push occurs on a PR that targets these branches
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
- development

jobs:
run-all-files:
if : ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:

# When a push occurs on a PR that targets these branches
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
- development
Expand All @@ -36,6 +41,7 @@ jobs:
ubuntu:

name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
if: ${{ !github.event.pull_request.draft }}
runs-on: ${{ matrix.os }}

strategy:
Expand Down Expand Up @@ -98,12 +104,13 @@ jobs:
run: |
python -m pip install --upgrade pip
python setup.py sdist
last_dist=$(ls -t dist/ContextuaRL-*.tar.gz | head -n 1)
last_dist=$(ls -t dist/carl-*.tar.gz | head -n 1)
pip install $last_dist[dev,dm_control]
- name: Tests
timeout-minutes: 60
run: |
echo "Running all tests..."
if [[ ${{ matrix.kind }} == 'conda' ]]; then
PYTHON=$CONDA/envs/testenv/bin/python3
export PATH="$CONDA/envs/testenv/bin:$PATH"
Expand Down
18 changes: 14 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,23 @@ CARL.egg-info
carl.egg-info
.mypy_cache
.pytest_cache
.coverage
.coverage*
exp_sweep
multirun
outputs
experiments
testvenv
*.egg-info
runs
*.png
*.pdf
*.csv
*.pickle
*.ipynb_checkpoints
*optgap*
*smac3*
*.json
generated
*egg*
core
*.png
*.tex
build
target
11 changes: 4 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "src/envs/rna/learna"]
path = src/envs/rna/learna
url = https://github.com/automl/learna.git
[submodule "src/envs/mario/TOAD-GUI"]
path = src/envs/mario/TOAD-GUI
[submodule "carl/envs/mario/TOAD-GUI"]
path = carl/envs/mario/TOAD-GUI
url = https://github.com/Mawiszus/TOAD-GUI
[submodule "src/envs/mario/Mario-AI-Framework"]
path = src/envs/mario/Mario-AI-Framework
[submodule "carl/envs/mario/Mario-AI-Framework"]
path = carl/envs/mario/Mario-AI-Framework
url = https://github.com/frederikschubert/Mario-AI-Framework
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ repos:
always_run: false
additional_dependencies: ["toml"] # Needed to parse pyproject.toml

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.930
hooks:
- id: mypy
name: mypy carl
files: carl/.*

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PYTEST ?= python -m pytest
CTAGS ?= ctags
PIP ?= python -m pip
MAKE ?= make
BLACK ?= black
BLACK ?= python -m black
ISORT ?= isort
PYDOCSTYLE ?= pydocstyle
MYPY ?= mypy
Expand Down Expand Up @@ -88,7 +88,7 @@ build:
$(PYTHON) setup.py sdist

doc:
$(MAKE) -C ${DOCDIR} all
$(MAKE) -C ${DOCDIR} docs
@echo
@echo "View docs at:"
@echo ${INDEX_HTML}
Expand Down
43 changes: 31 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pip install .

This will only install the basic classic control environments, which should run on most operating systems. For the full set of environments, use the install options:
```bash
pip install -e .[box2d, brax, mario, dm_control]
pip install -e .[box2d,brax,dm_control,mario,rna]
```

These may not be compatible with Windows systems. Box2D environment may need to be installed via conda on MacOS systems:
Expand All @@ -50,13 +50,26 @@ conda install -c conda-forge gym-box2d
```

In general, we test on Linux systems, but aim to keep the benchmark compatible with MacOS as much as possible.
Mario at this point, however, will not run on any operation system besides Linux
RNA and Mario at this point, however, will not run on any operation system besides Linux.

To install the additional requirements for ToadGAN:
To install ToadGAN for the Mario environment:
```bash
javac carl/envs/mario/Mario-AI-Framework/**/*.java
git submodule update --init --recursive

# if this does not work, clone manually
git clone https://github.com/frederikschubert/Mario-AI-Framework carl/envs/mario/Mario-AI-Framework
git clone https://github.com/Mawiszus/TOAD-GUI carl/envs/mario/TOAD-GUI

# System requirements
sudo apt install libfreetype6-dev xvfb

# Compile java source files
cd carl/envs/mario/Mario-AI-Framework/src
javac *.java
```

If you want to use RNA, please take a look at the associated [ReadME](carl/envs/rna/readme.md).

## CARL's Contextual Extension
CARL contextually extends the environment by making the context visible and configurable.
During training we therefore can encounter different contexts and train for generalization.
Expand All @@ -68,16 +81,22 @@ Different instiations can be achieved by setting the context features to differe
## Cite Us
If you use CARL in your research, please cite our paper on the benchmark:
```bibtex
@inproceedings{BenEim2021a,
title = {CARL: A Benchmark for Contextual and Adaptive Reinforcement Learning},
author = {Carolin Benjamins and Theresa Eimer and Frederik Schubert and André Biedenkapp and Bodo Rosenhahn and Frank Hutter and Marius Lindauer},
booktitle = {NeurIPS 2021 Workshop on Ecological Theory of Reinforcement Learning},
year = {2021},
month = dec
@inproceedings { BenEim2023a,
author = {Carolin Benjamins and
Theresa Eimer and
Frederik Schubert and
Aditya Mohan and
Sebastian Döhler and
André Biedenkapp and
Bodo Rosenhahn and
Frank Hutter and
Marius Lindauer},
title = {Contextualize Me - The Case for Context in Reinforcement Learning},
journal = {Transactions on Machine Learning Research},
year = {2023},
}
```
You can find the code and experiments for this paper in the `neurips_ecorl_workshop_2021` branch.
```

## References
[OpenAI gym, Brockman et al., 2016. arXiv preprint arXiv:1606.01540](https://arxiv.org/pdf/1606.01540.pdf)
Expand Down
6 changes: 3 additions & 3 deletions carl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
__license__ = "Apache-2.0 License"
__version__ = "0.2.0"
__version__ = "1.0.0"
__author__ = "Carolin Benjamins, Theresa Eimer, Frederik Schubert, André Biedenkapp, Aditya Mohan, Sebastian Döhler"


import datetime

name = "CARL"
package_name = "ContextuaRL"
package_name = "carl"
author = __author__

author_email = "benjamins@tnt.uni-hannover.de"
description = "CARL- Contextually Adaptive Reinforcement Learning"
url = "https://www.automl.org/"
project_urls = {
"Documentation": "https://carl.readthedocs.io/en/latest/",
"Documentation": "https://automl.github.io/CARL",
"Source Code": "https://github.com/https://github.com/automl/CARL",
}
copyright = f"""
Expand Down
40 changes: 0 additions & 40 deletions carl/context/augmentation.py

This file was deleted.

Loading

0 comments on commit 9e6788c

Please sign in to comment.