Skip to main content

A modular, meta-learning-ready RL library.

Project description

Mighty Logo

PyPI Version Python License Test Doc Status


Mighty

Warning: Mighty is still in development without an official release! Use at your own peril and check back frequently for updates!

Welcome to Mighty, hopefully your future one-stop shop for everything cRL. Currently Mighty is still in its early stages with support for normal gym envs, DACBench and CARL. The interface is controlled through hydra and we provide DQN, PPO and SAC algorithms. We log training and regular evaluations to file and optionally also to tensorboard or wandb. If you have any questions or feedback, please tell us, ideally via the GitHub issues!

Mighty features:

  • Modular structure for easy (Meta-)RL tinkering
  • PPO, SAC and DQN as base algorithms
  • Environment integrations via Gymnasium, Pufferlib, CARL & DACBench
  • Implementations of some important baselines: MAML, PLR, Cosine LR Schedule and more!

Installation

We recommend to using uv to install and run Mighty in a virtual environment. The code has been tested with python 3.10.

First create a clean python environment:

uv venv --python=3.10
source .venv/bin/activate

Then install Mighty:

make install

Optionally you can install the dev requirements directly:

make install-dev

Run a Mighty Agent

In order to run a Mighty Agent, use the run_mighty.py script and provide any training options as keywords. If you want to know more about the configuration options, call:

python mighty/run_mighty.py --help

An example for running the PPO agent on the Pendulum gym environment looks like this:

python mighty/run_mighty.py 'algorithm=ppo' 'environment=gymnasium/pendulum'

Learning a Configuration Policy via DAC

In order to use Mighty with DACBench, you need to install DACBench first. We recommend following the instructions in the DACBench repo.

Afterwards, select the benchmark you want to run, for example the SigmoidBenchmark, and providing it as the "env" keyword:

python mighty/run_mighty.py 'algorithm=dqn' 'env=SigmoidBenchmark' 'env_wrappers=[dacbench.wrappers.MultiDiscreteActionWrapper]'

Train your Agent on a CARL Environment

Mighty is designed with contextual RL in mind and therefore fully compatible with CARL. Before you start training, however, please follow the installation instructions in the CARL repo.

Then use the same command as before, but provide the CARL environment, in this example CARLCartPoleEnv, and information about the context distribution as keywords:

python mighty/run_mighty.py 'algorithm=dqn' 'env=CARLCartPoleEnv' '+env_kwargs.num_contexts=10' '+env_kwargs.context_feature_args=[gravity]'

Optimize Hyperparameters

You can optimize the hyperparameters of your algorithm with the Hypersweeper package, e.g. using SMAC3. Mighty is directly compatible with Hypersweeper and thus smart and distributed HPO!

Further Examples

We provide further examples, such as how to plot the logged evaluation data, in the examples folder.

Cite Us

If you use Mighty in your work, please cite us:

@misc{mohaneimer24,
  author    = {A. Mohan and T. Eimer and C. Benjamins and F. Hutter and M. Lindauer and A. Biedenkapp},
  title     = {Mighty},
  year      = {2024},
  url = {https://github.com/automl/mighty}
}

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

mighty_rl-0.0.1.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mighty_rl-0.0.1-py3-none-any.whl (73.9 kB view details)

Uploaded Python 3

File details

Details for the file mighty_rl-0.0.1.tar.gz.

File metadata

  • Download URL: mighty_rl-0.0.1.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for mighty_rl-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8853e86fb4cb4de44dd12dd13240b16ddb23e9a66ea55e3479e7db3508ff64cf
MD5 ea0708852eaf3490396d8f185fd1d37c
BLAKE2b-256 42b049ef0ce954b3f7bd8336609350823c9acc0b195910003c681101b3976c9d

See more details on using hashes here.

File details

Details for the file mighty_rl-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mighty_rl-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 73.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for mighty_rl-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72544d727ded3de5654a1658301d280f53a543edc9ed0bb4d639f5afee38192d
MD5 3bd0956d490e200c0594eb63ac3b4da5
BLAKE2b-256 77c970572ffd27af6166dd304d9a60ad365e1bd8c03e158dd712e6c138b0b7f4

See more details on using hashes here.

Supported by

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