HELX: The RL experiments framework
Quickstart | Installation | Examples | Cite
What is HELX?
HELX is a JAX-based ecosystem that provides a standardised and ready to use framework to run Reinforcement Learning experiments.
The ecosystem is made of three main nodes:
- HELX-base, containing the base objects of the framework
- HELX-agents, containing the most common RL baselines
- HELX-envs, which provides a single API to the most common RL environments (gym, gymnax, dm_env, atari, ...)
- Finally, HELX, which packs the other three nodes into a framework to run and manage experiments
Installation
Install the stable version of helx and its dependencies with:
pip install helx
Or, if you prefer to install the latest version from source:
pip install git+https://github.com/epignatelli/helx
Examples
A typical use case is to design an agent, and toy-test it on catch before evaluating it on more complex environments, such as atari, procgen or mujoco.
import bsuite
import gym
import helx.environment
import helx.experiment
import helx.agents
# create the enviornment in you favourite way
env = bsuite.load_from_id("catch/0")
# convert it to an helx environment
env = helx.environment.to_helx(env)
# create the agent
hparams = helx.agents.Hparams(env.obs_space(), env.action_space())
agent = helx.agents.Random(hparams)
# run the experiment
helx.experiment.run(env, agent, episodes=100)
Switching to a different environment is as simple as changing the env variable.
import bsuite
import gym
import helx.environment
import helx.experiment
import helx.agents
# create the enviornment in you favourite way
-env = bsuite.load_from_id("catch/0")
+env = gym.make("procgen:procgen-coinrun-v0")
# convert it to an helx environment
env = helx.environment.to_helx(env)
# create the agent
hparams = helx.agents.Hparams(env.obs_space(), env.action_space())
agent = helx.agents.Random(hparams)
# run the experiment
helx.experiment.run(env, agent, episodes=100)
Supported libraries
We currently support these external environment models:
On the road:
Adding a new agent (helx.agents.Agent)
An helx agent interface is designed as the minimal set of functions necessary to (i) interact with an environment and (ii) reinforcement learn.
class Agent(ABC):
"""A minimal RL agent interface."""
@abstractmethod
def sample_action(self, timestep: Timestep) -> Array:
"""Applies the agent's policy to the current timestep to sample an action."""
@abstractmethod
def update(self, timestep: Timestep) -> Any:
"""Updates the agent's internal state (knowledge), such as a table,
or some function parameters, e.g., the parameters of a neural network."""
Adding a new environment library (helx.environment.Environment)
To add a new library requires three steps:
- Implement the
helx.environment.Environmentinterface for the new library. See the dm_env implementation for an example. - Implement serialisation (to
helx) of the following objects:helx.environment.Timestephelx.spaces.Discretehelx.spaces.Continuous
- Add the new library to the
helx.environment.to_helxfunction to tellhelxabout the new protocol.
Cite
If you use helx please consider citing it as:
@misc{helx,
author = {Pignatelli, Eduardo},
title = {Helx: Interoperating between Reinforcement Learning Experimental Protocols},
year = {2021},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/epignatelli/helx}}
}
A note on maintainance
This repository was born as the recipient of personal research code that was developed over the years. Its maintainance is limited by the time and the resources of a research project resourced with a single person. Even if I would like to automate many actions, I do not have the time to maintain the whole body of automation that a well maintained package deserves. This is the reason of the WIP badge, which I do not plan to remove soon. Maintainance will prioritise the code functionality over documentation and automation.
Any help is very welcome. A quick guide to interacting with this repository:
- If you find a bug, please open an issue, and I will fix it as soon as I can.
- If you want to request a new feature, please open an issue, and I will consider it as soon as I can.
- If you want to contribute yourself, please open an issue first, let's discuss objective, plan a proposal, and open a pull request to act on it.
If you would like to be involved further in the development of this repository, please contact me directly at: edu dot pignatelli at gmail dot com.
Metadata
Release files for HELX-base 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| HELX-base-1.0.0.tar.gz | 23.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| HELX_base-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 44.3 kB
Release files / HELX-base-1.0.0.tar.gz
| Download URL | HELX-base-1.0.0.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a132fdee9d9341f3a568dae43b30622d00049dd6e57da7cd09e9c0d732e46f0b
|
|
BLAKE2b-256 checksum How to use checksums |
ed7a46ded7b4d78db6eba33721964f512f8b6e8fa041e2781a838ab8cee229b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / HELX_base-1.0.0-py2.py3-none-any.whl
| Download URL | HELX_base-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d0e50acb0ec9e1d972d71ee595a166f3537106b74042e9b809e3bf7b28b1c010
|
|
BLAKE2b-256 checksum How to use checksums |
955d23b2c227c71bd0188c3c0ed48350a58a4516fa4acee1c3afe3d4456c43a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|