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
Shuffle Attention for MobileNetV3

SA-MobileNetV3 Shuffle Attention for MobileNetV3 Train Run the following command for train model on your own dataset: python train.py --dataset mnist

Sajjad Aemmi 36 Dec 28, 2022
CVPR 2021 Challenge on Super-Resolution Space

Learning the Super-Resolution Space Challenge NTIRE 2021 at CVPR Learning the Super-Resolution Space challenge is held as a part of the 6th edition of

andreas 104 Oct 26, 2022
Implementation of BI-RADS-BERT & The Advantages of Section Tokenization.

BI-RADS BERT Implementation of BI-RADS-BERT & The Advantages of Section Tokenization. This implementation could be used on other radiology in house co

1 May 17, 2022
The official implementation of paper Siamese Transformer Pyramid Networks for Real-Time UAV Tracking, accepted by WACV22

SiamTPN Introduction This is the official implementation of the SiamTPN (WACV2022). The tracker intergrates pyramid feature network and transformer in

Robotics and Intelligent Systems Control @ NYUAD 29 Jan 08, 2023
Very large and sparse networks appear often in the wild and present unique algorithmic opportunities and challenges for the practitioner

Sparse network learning with snlpy Very large and sparse networks appear often in the wild and present unique algorithmic opportunities and challenges

Andrew Stolman 1 Apr 30, 2021
The official repository for our paper "The Neural Data Router: Adaptive Control Flow in Transformers Improves Systematic Generalization".

Codebase for learning control flow in transformers The official repository for our paper "The Neural Data Router: Adaptive Control Flow in Transformer

Csordás Róbert 24 Oct 15, 2022
Generate saved_model, tfjs, tf-trt, EdgeTPU, CoreML, quantized tflite and .pb from .tflite.

tflite2tensorflow Generate saved_model, tfjs, tf-trt, EdgeTPU, CoreML, quantized tflite and .pb from .tflite. 1. Supported Layers No. TFLite Layer TF

Katsuya Hyodo 214 Dec 29, 2022
A really easy-to-use and powerful sudoku solver.

SodukuSolver This is a really useful sudoku solver with a Qt gui. USAGE Enter the numbers in and click "RUN"! If you don't want to wait, simply press

Ujhhgtg Teams 11 Jun 02, 2022
Code to accompany the paper "Finding Bipartite Components in Hypergraphs", which is published in NeurIPS'21.

Finding Bipartite Components in Hypergraphs This repository contains code to accompany the paper "Finding Bipartite Components in Hypergraphs", publis

Peter Macgregor 5 May 06, 2022
SeqFormer: a Frustratingly Simple Model for Video Instance Segmentation

SeqFormer: a Frustratingly Simple Model for Video Instance Segmentation SeqFormer SeqFormer: a Frustratingly Simple Model for Video Instance Segmentat

Junfeng Wu 298 Dec 22, 2022
Multi-layer convolutional LSTM with Pytorch

Convolution_LSTM_pytorch Thanks for your attention. I haven't got time to maintain this repo for a long time. I recommend this repo which provides an

Zijie Zhuang 734 Jan 03, 2023
1st Place Solution to ECCV-TAO-2020: Detect and Represent Any Object for Tracking

Instead, two models for appearance modeling are included, together with the open-source BAGS model and the full set of code for inference. With this code, you can achieve around 79 Oct 08, 2022

Temporally Coherent GAN SIGGRAPH project.

TecoGAN This repository contains source code and materials for the TecoGAN project, i.e. code for a TEmporally COherent GAN for video super-resolution

Duc Linh Nguyen 2 Jan 18, 2022
PyTorch implementation of ShapeConv: Shape-aware Convolutional Layer for RGB-D Indoor Semantic Segmentation.

Shape-aware Convolutional Layer (ShapeConv) PyTorch implementation of ShapeConv: Shape-aware Convolutional Layer for RGB-D Indoor Semantic Segmentatio

Hanchao Leng 82 Dec 29, 2022
Code accompanying the paper "How Tight Can PAC-Bayes be in the Small Data Regime?"

How Tight Can PAC-Bayes be in the Small Data Regime? This is the code to reproduce all experiments for the following paper: @inproceedings{Foong:2021:

5 Dec 21, 2021
An easy way to build PyTorch datasets. Modularly build datasets and automatically cache processed results

EasyDatas An easy way to build PyTorch datasets. Modularly build datasets and automatically cache processed results Installation pip install git+https

Ximing Yang 4 Dec 14, 2021
Official PyTorch Implementation for InfoSwap: Information Bottleneck Disentanglement for Identity Swapping

InfoSwap: Information Bottleneck Disentanglement for Identity Swapping Code usage Please check out the user manual page. Paper Gege Gao, Huaibo Huang,

Grace Hešeri 56 Dec 20, 2022
Spatial Contrastive Learning for Few-Shot Classification (SCL)

This repo contains the official implementation of Spatial Contrastive Learning for Few-Shot Classification (SCL), which presents of a novel contrastive learning method applied to few-shot image class

Yassine 34 Dec 25, 2022
PyTorch for Semantic Segmentation

PyTorch for Semantic Segmentation This repository contains some models for semantic segmentation and the pipeline of training and testing models, impl

Zijun Deng 1.7k Jan 06, 2023
OpenPCDet Toolbox for LiDAR-based 3D Object Detection.

OpenPCDet OpenPCDet is a clear, simple, self-contained open source project for LiDAR-based 3D object detection. It is also the official code release o

OpenMMLab 3.2k Dec 31, 2022