Skip to main content

MTEnv: MultiTask Environments for Reinforcement Learning

Project description

CircleCI PyPI - License PyPI - Python Version Code style: black Zulip Chat

MTEnv

MultiTask Environments for Reinforcement Learning.

Contents

  1. Introduction

  2. Installation

  3. Usage

  4. Documentation

  5. Contributing to MTEnv

  6. Community

  7. Acknowledgements

Introduction

MTEnv is a library to interface with environments for multi-task reinforcement learning. It has two main components:

Together, these two components should provide a standard interface for multi-task RL environments and make it easier to reuse components and tools across environments.

You can read more about the difference between MTEnv and single-task environments here.

List of publications & submissions using MTEnv (please create a pull request to add the missing entries):

License

Citing MTEnv

If you use MTEnv in your research, please use the following BibTeX entry:

@Misc{Sodhani2021MTEnv,
  author =       {Shagun Sodhani and Ludovic Denoyer and Pierre-Alexandre Kamienny and Olivier Delalleau},
  title =        {MTEnv - Environment interface for mulit-task reinforcement learning},
  howpublished = {Github},
  year =         {2021},
  url =          {https://github.com/facebookresearch/mtenv}
}

Installation

MTEnv has two components - a core API and environments that implement the API.

The Core API can be installed via pip install mtenv or pip install git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv

The list of environments, that implement the API, is available here. Any of these environments can be installed via pip install git+https://github.com/facebookresearch/mtenv.git@main#egg="mtenv[env_name]". For example, the MetaWorld environment can be installed via pip install git+https://github.com/facebookresearch/mtenv.git@main#egg="mtenv[metaworld]".

All the environments can be installed at once using pip install git+https://github.com/facebookresearch/mtenv.git@main#egg="mtenv[all]". However, note that some environments may have incompatible dependencies.

MTEnv can also be installed from the source by first cloning the repo (git clone git@github.com:facebookresearch/mtenv.git), cding into the directory cd mtenv, and then using the pip commands as described above. For example, pip install mtenv to install the core API, and pip install "mtenv[env_name]" to install a particular environment.

Usage

MTEnv provides an interface very similar to the standard gym environments. One key difference between multi-task environments (that implement the MTEnv interface) and single-task environments is in terms of observation that they return.

MultiTask Observation

The multi-task environments return a dictionary as the observation. This dictionary has two keys: (i) env_obs, which maps to the observation from the environment (i.e., the observation that a single task environments return), and (ii) task_obs, which maps to the task-specific information from the environment. In the simplest case, task_obs can be an integer denoting the task index. In other cases, task_obs can provide richer information.

from mtenv import make
env = make("MT-MetaWorld-MT10-v0")
obs = env.reset()
print(obs)
# {'env_obs': array([-0.03265039,  0.51487777,  0.2368754 , -0.06968209,  0.6235982 ,
#    0.01492813,  0.        ,  0.        ,  0.        ,  0.03933976,
#    0.89743189,  0.01492813]), 'task_obs': 1}
action = env.action_space.sample()
print(action)
# array([-0.76422   , -0.15384133,  0.74575615, -0.11724994], dtype=float32)
obs, reward, done, info = env.step(action)
print(obs)
# {'env_obs': array([-0.02583682,  0.54065546,  0.22773503, -0.06968209,  0.6235982 ,
#    0.01494118,  0.        ,  0.        ,  0.        ,  0.03933976,
#    0.89743189,  0.01492813]), 'task_obs': 1}

Documentation

https://mtenv.readthedocs.io

Contributing to MTEnv

There are several ways to contribute to MTEnv.

  1. Use MTEnv in your research.

  2. Contribute a new environment. We support many environments via MTEnv and are looking forward to adding more environments. Contributors will be added as authors of the library. You can learn more about the workflow of adding an environment here.

  3. Check out the good-first-issues on GitHub and contribute to fixing those issues.

  4. Check out additional details here.

Community

Ask questions in the chat or github issues:

Acknowledgements

  • Project file pre-commit, mypy config, towncrier config, circleci etc are based on same files from Hydra.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mtenv-1.0.tar.gz (150.3 kB view details)

Uploaded Source

Built Distribution

mtenv-1.0-py3-none-any.whl (109.9 kB view details)

Uploaded Python 3

File details

Details for the file mtenv-1.0.tar.gz.

File metadata

  • Download URL: mtenv-1.0.tar.gz
  • Upload date:
  • Size: 150.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.6

File hashes

Hashes for mtenv-1.0.tar.gz
Algorithm Hash digest
SHA256 8b1e9b80a2a19cfb32eaf954fe2a2bd415e68e2390b9eaac3afd85751c9bc446
MD5 3ec56695d4f58bf43d6806ac9452a2a4
BLAKE2b-256 9268766cc79d0bb16137703a0476c5708dfe0917661d372ae3588bb9017b386d

See more details on using hashes here.

File details

Details for the file mtenv-1.0-py3-none-any.whl.

File metadata

  • Download URL: mtenv-1.0-py3-none-any.whl
  • Upload date:
  • Size: 109.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.6

File hashes

Hashes for mtenv-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f49e9365ffa62706c9523f3f0d5989e0208339b6ca7a86c445d935695586621
MD5 d8d6a5039377518d62e1fc787ef60c83
BLAKE2b-256 f93579495c9fe7acaff07172c9d583739d8361a476cf599b25998c132a3abffb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page