CARL provides highly configurable contextual extensions to several well-known RL environments.

Related tags

Deep LearningCARL
Overview

The CARL Benchmark Library

CARL (context adaptive RL) provides highly configurable contextual extensions to several well-known RL environments. It's designed to test your agent's generalization capabilities in all scenarios where intra-task generalization is important.

Benchmarks include:

  • OpenAI gym classic control suite extended with several physics context features like gravity or friction

  • OpenAI gym Box2D BipedalWalker, LunarLander and CarRacing, each with their own modification possibilities like new vehicles to race

  • All Brax locomotion environments with exposed internal features like joint strength or torso mass

  • Super Mario (TOAD-GAN), a procedurally generated jump'n'run game with control over level similarity

  • RNADesign, an environment for RNA design given structure constraints with structures from different datasets to choose from

Screenshot of each environment included in CARL.

Installation

We recommend you use a virtual environment (e.g. Anaconda) to install CARL and its dependencies. We recommend and test with python 3.9 under Linux.

First, clone our repository and install the basic requirements:

git clone https://github.com/automl/CARL.git --recursive
cd CARL
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:

pip install -e .[box2d, brax, rna, mario]

These may not be compatible with Windows systems. Box2D environment may need to be installed via conda on MacOS systems:

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

To install the additional requirements for ToadGAN:

javac src/envs/mario/Mario-AI-Framework/**/*.java

If you want to use the RNA design environment:

cd src/envs/rna/learna
make requirements
make data

In case you want to run our experiments or use our training files, also install the experiment dependencies:

pip install -e .[experiments]

Train an Agent

To get started with CARL, you can use our 'train.py' script. It will train a PPO agent on the environment of your choice with custom context variations that are sampled from a standard deviation.

To use MetaCartPole with variations in gravity and friction by 20% compared to the default, run:

python train.py 
--env CARLCartPoleEnv 
--context_args gravity friction
--default_sample_std_percentage 0.2
--outdir <result_location>

You can use the plotting scripts in src/eval to view the results.

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. We exemplarily show how Brax' Fetch is extended and embedded by CARL. Different instiations can be achieved by setting the context features to different values.

CARL contextually extends Brax' Fetch.

Cite Us

@misc{CARL,
  author    = {C. Benjamins and 
               T. Eimer and 
               F. Schubert and 
               A. Biedenkapp and 
               B. Rosenhahn and 
               F. Hutter and 
               M. Lindauer},
  title     = {CARL: A Benchmark for Contextual and Adaptive Reinforcement Learning},
  howpublished = {https://github.com/automl/CARL},
  year      = {2021},
  month     = aug,
}

References

OpenAI gym, Brockman et al., 2016. arXiv preprint arXiv:1606.01540

Brax -- A Differentiable Physics Engine for Large Scale Rigid Body Simulation, Freeman et al., NeurIPS 2021 (Dataset & Benchmarking Track)

TOAD-GAN: Coherent Style Level Generation from a Single Example, Awiszus et al., AIIDE 2020

Learning to Design RNA, Runge et al., ICRL 2019

License

CARL falls under the Apache License 2.0 (see file 'LICENSE') as is permitted by all work that we use. This includes CARLMario, which is not based on the Nintendo Game, but on TOAD-GAN and TOAD-GUI running under an MIT license. They in turn make use of the Mario AI framework (https://github.com/amidos2006/Mario-AI-Framework). This is not the original game but a replica, explicitly built for research purposes and includes a copyright notice (https://github.com/amidos2006/Mario-AI-Framework#copyrights ).

Comments
  • Rna fixup

    Rna fixup

    RNA is now better documented and more easily runnable. There's also an option to subsample the datasets instead of always using all instances per context.

    The thing that's missing right now are more context options like filtering by solvers or GC-content, but those aren't easily extractable from our data right now, so that's a separate work package all together.

    opened by TheEimer 6
  • Gym 0.22.0

    Gym 0.22.0

    • update required minimum gym version number
    • added pygame as a requirement because it is not picked up by the gym requirements
    • getting rid of CustomBipedalWalkerEnv because the functionality of changing the gravity is covered by CARLEnv (same for CustomLunarLanderEnv)
    • add high game over penalty for LunarLander by a wrapper
    opened by benjamc 6
  • Instance selection

    Instance selection

    Instance selection now is a class. Default is still roundrobin selection. An instance is only selected when env.reset() (or to be more specific, _progress_instance() is called.

    opened by benjamc 4
  • Added Encoders

    Added Encoders

    Context encoders have been added as a folder and an experiment for running the encoder added in the experiments folders. Since the working directory is the experiment one, I had to add an absolute path for the saved weights. This might need to be changed in the config file

    opened by amsks 4
  • Update References with correct conference

    Update References with correct conference

    Thanks for the pointer to the survey, but it hasn't been published anywhere, so that detail is incorrect (I wouldn't want to claim that it's published somewhere when it isn't).

    opened by RobertKirk 3
  • Performance Deviations in Brax

    Performance Deviations in Brax

    Comparing HalfCheetah in Brax (via gym.make and then wrapped as here: https://github.com/google/brax/blob/main/notebooks/training_torch.ipynb) vs in CARL makes a big difference in return even when the context is kept static. Do we do any unexpected reward normalization? Does the way we reset the env make a difference compared to theirs (as we actually update the simluation)?

    bug 
    opened by TheEimer 2
  • Integrate DM Control

    Integrate DM Control

    • [ ] (convert test file to jupyter notebook. I would like to keep that)
    • [ ] check tests / write more to increase coverage
    • [x] update README.md
    • [x] update documentation
    • [x] add dm_control to requirements
    • [x] support dict observation space
    documentation tests 
    opened by benjamc 2
  • Fix gym version

    Fix gym version

    Gym released a new version where the signature of the step function has changed. This affects our code and requires a separate PR. For now, fix the gym version.

    opened by benjamc 1
  • Initial statedistrs #48

    Initial statedistrs #48

    #48 Make initial state distribution configurable. So far, only uniform distributions are used and the bounds can be adjusted.

    Classic control:

    • [x] Acrobot
    • [x] Pendulum
    • [x] MountainCar (normal distribution instead of uniform)
    • [x] MountainCarContinuous (uniform distribution)
    • [x] CartPole

    Box2d

    • [x] LunarLander

    • [ ] (maybe/later) Make distributions fully configurable by passing the distribution class and its parameters.

    • [x] Update documentation: Contexts are automatically filled with the default context if underspecified.

    opened by benjamc 1
  • Integrate dmcontrol

    Integrate dmcontrol

    Add support for dm control environments. Integrated walker, quadruped and fish.

    In dmc environments there is an additional setting for the context, namely the context mask, which can reduce the amount of context features.

    opened by sebidoe 1
  • use appropriate library for building states

    use appropriate library for building states

    So far, when we do not hide the context, we concatenate the context to the state. For jax based environments (brax) this means that the state is converted from a jax to a numpy array. Now, the state builder checks which library to use and keeps jax states as jax arrays and numpy states as numpy arrays.

    Noticed in #42.

    opened by benjamc 1
  • AttributeError: 'System' object has no attribute 'body_idx' in brax

    AttributeError: 'System' object has no attribute 'body_idx' in brax

    when running test/test_all_envs.py, there is AttributeError: 'System' object has no attribute 'body_idx' in carl_fetch and carl_humanoid environments.

    opened by andy-james0310 3
Releases(v0.2.0)
  • v0.2.0(Jul 12, 2022)

    • Integrate dm control environments (#55)
    • Add context masks to only append those to the state (#54)
    • Extend classic control environments to parametrize initial state distributions (#52)
    • Remove RNA environment for maintenance (#61)
    • Fixed pre-commit (mypy, black, flake8, isort) (#62)
    Source code(tar.gz)
    Source code(zip)
Owner
AutoML-Freiburg-Hannover
AutoML-Freiburg-Hannover
An addon uses SMPL's poses and global translation to drive cartoon character in Blender.

Blender addon for driving character The addon drives the cartoon character by passing SMPL's poses and global translation into model's armature in Ble

犹在镜中 153 Dec 14, 2022
An implementation of Video Frame Interpolation via Adaptive Separable Convolution using PyTorch

This work has now been superseded by: https://github.com/sniklaus/revisiting-sepconv sepconv-slomo This is a reference implementation of Video Frame I

Simon Niklaus 984 Dec 16, 2022
Recommendationsystem - Movie-recommendation - matrixfactorization colloborative filtering recommendation system user

recommendationsystem matrixfactorization colloborative filtering recommendation

kunal jagdish madavi 1 Jan 01, 2022
Activating More Pixels in Image Super-Resolution Transformer

HAT [Paper Link] Activating More Pixels in Image Super-Resolution Transformer Xiangyu Chen, Xintao Wang, Jiantao Zhou and Chao Dong BibTeX @article{ch

XyChen 270 Dec 27, 2022
Final project code: Implementing BicycleGAN, for CIS680 FA21 at University of Pennsylvania

680 Final Project: BicycleGAN Haoran Tang Instructions 1. Training To train the network, please run train.py. Change hyper-parameters and folder paths

Haoran Tang 0 Apr 22, 2022
Predicting 10 different clothing types using Xception pre-trained model.

Predicting-Clothing-Types Predicting 10 different clothing types using Xception pre-trained model from Keras library. It is reimplemented version from

AbdAssalam Ahmad 3 Dec 29, 2021
Robust Lane Detection via Expanded Self Attention (WACV 2022)

Robust Lane Detection via Expanded Self Attention (WACV 2022) Minhyeok Lee, Junhyeop Lee, Dogyoon Lee, Woojin Kim, Sangwon Hwang, Sangyoun Lee Overvie

Min Hyeok Lee 18 Nov 12, 2022
Read and write layered TIFF ImageSourceData and ImageResources tags

Read and write layered TIFF ImageSourceData and ImageResources tags Psdtags is a Python library to read and write the Adobe Photoshop(r) specific Imag

Christoph Gohlke 4 Feb 05, 2022
[v1 (ISBI'21) + v2] MedMNIST: A Large-Scale Lightweight Benchmark for 2D and 3D Biomedical Image Classification

MedMNIST Project (Website) | Dataset (Zenodo) | Paper (arXiv) | MedMNIST v1 (ISBI'21) Jiancheng Yang, Rui Shi, Donglai Wei, Zequan Liu, Lin Zhao, Bili

683 Dec 28, 2022
Callable PyTrees and filtered JIT/grad transformations => neural networks in JAX.

Equinox Callable PyTrees and filtered JIT/grad transformations = neural networks in JAX Equinox brings more power to your model building in JAX. Repr

Patrick Kidger 909 Dec 30, 2022
Active Offline Policy Selection With Python

Active Offline Policy Selection This is supporting example code for NeurIPS 2021 paper Active Offline Policy Selection by Ksenia Konyushkova*, Yutian

DeepMind 27 Oct 15, 2022
Official code for On Path Integration of Grid Cells: Group Representation and Isotropic Scaling (NeurIPS 2021)

On Path Integration of Grid Cells: Group Representation and Isotropic Scaling This repo contains the official implementation for the paper On Path Int

Ruiqi Gao 39 Nov 10, 2022
Code for the paper: "On the Bottleneck of Graph Neural Networks and Its Practical Implications"

On the Bottleneck of Graph Neural Networks and its Practical Implications This is the official implementation of the paper: On the Bottleneck of Graph

75 Dec 22, 2022
Nonuniform-to-Uniform Quantization: Towards Accurate Quantization via Generalized Straight-Through Estimation. In CVPR 2022.

Nonuniform-to-Uniform Quantization This repository contains the training code of N2UQ introduced in our CVPR 2022 paper: "Nonuniform-to-Uniform Quanti

Zechun Liu 60 Dec 28, 2022
Code release for the paper “Worldsheet Wrapping the World in a 3D Sheet for View Synthesis from a Single Image”, ICCV 2021.

Worldsheet: Wrapping the World in a 3D Sheet for View Synthesis from a Single Image This repository contains the code for the following paper: R. Hu,

Meta Research 37 Jan 04, 2023
The implementation of 'Image synthesis via semantic composition'.

Image synthesis via semantic synthesis [Project Page] by Yi Wang, Lu Qi, Ying-Cong Chen, Xiangyu Zhang, Jiaya Jia. Introduction This repository gives

DV Lab 71 Jan 06, 2023
A naive ROS interface for visualDet3D.

YOLO3D ROS Node This repo contains a Monocular 3D detection Ros node. Base on https://github.com/Owen-Liuyuxuan/visualDet3D All parameters are exposed

Yuxuan Liu 19 Oct 08, 2022
[CVPR 2021] MetaSAug: Meta Semantic Augmentation for Long-Tailed Visual Recognition

MetaSAug: Meta Semantic Augmentation for Long-Tailed Visual Recognition (CVPR 2021) arXiv Prerequisite PyTorch = 1.2.0 Python3 torchvision PIL argpar

51 Nov 11, 2022
DeepLab2: A TensorFlow Library for Deep Labeling

DeepLab2 is a TensorFlow library for deep labeling, aiming to provide a unified and state-of-the-art TensorFlow codebase for dense pixel labeling tasks.

Google Research 845 Jan 04, 2023
A PyTorch implementation of EventProp [https://arxiv.org/abs/2009.08378], a method to train Spiking Neural Networks

Spiking Neural Network training with EventProp This is an unofficial PyTorch implemenation of EventProp, a method to compute exact gradients for Spiki

Pedro Savarese 35 Jul 29, 2022