Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate repo back #65

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get version from file
run: |
VERSION_FILE="$/helx_base/_version.py"
HELX_VERSION="$(cat helx_base/_version.py | grep '__version__ = ' | cut -d'=' -f2 | sed 's,\",,g' | sed "s,\',,g" | sed 's, ,,g')"
HELX_VERSION="$(cat helx/_version.py | grep '__version__ = ' | cut -d'=' -f2 | sed 's,\",,g' | sed "s,\',,g" | sed 's, ,,g')"
echo "Current version is:"
echo "$HELX_VERSION"

Expand All @@ -38,12 +37,12 @@ jobs:
uses: ncipollo/release-action@v1
with:
tag: ${{ env.HELX_VERSION }}
name: "HELX-base release v${{ env.HELX_VERSION }}"
name: "HELX release v${{ env.HELX_VERSION }}"
body: ${{ steps.changelog.outputs.clean_changelog }}

- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'

- name: Install pypa/build
run: |
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
jobs:
Test:
runs-on: ${{ matrix.os }}-latest
permissions:
contents: read
packages: write
defaults:
run:
shell: bash -l {0}
Expand All @@ -32,12 +35,21 @@ jobs:
pip install pylint
MESSAGE=$(pylint -ry $(git ls-files '*.py') ||:)
echo "$MESSAGE"
- name: Run unit tests with pytest
# - name: Run unit tests with pytest
# run: |
# pytest test/
- name: Run examples
run: |
python -c 'import helx_base'
wandb login ${{ secrets.WANDB_API_KEY }}
wandb disabled
for f in examples/*.py; do python $f; done

Compliance:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ on:
jobs:
assign-project:
runs-on: ubuntu-latest
permissions:
contents: write
repository-projects: write
steps:
- uses: actions/add-to-project@v0.4.0
with:
project-url: https://github.com/users/epignatelli/projects/7
github-token: ${{ secrets.TRIAGE_KEY }}
assign-assignee:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
Expand Down
134 changes: 0 additions & 134 deletions .gitignore

This file was deleted.

74 changes: 38 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

## What is HELX?

HELX is a JAX-based ecosystem that provides a standardised and ready to use framework to run Reinforcement Learning experiments.
HELX is a JAX-based ecosystem that provides a standardised framework to run Reinforcement Learning experiments.
With HELX you easily can:
- Use the `helx.envs` namespace to use the most common RL environments (gym, gymnax, dm_env, atari, ...)
- Use the `helx.agents` namespace to use the most common RL agents (DQN, PPO, SAC, ...)
- Use the `helx.experiment` namespace to run experiments on your local machine, on a cluster, or on the cloud
- Use the `helx.base` namespace to access the most common RL data structures and functions (e.g., a Ring buffer)

The ecosystem is made of three main nodes:
- [HELX-base](https://github.com/epignatelli/helx), containing the base objects of the framework
- [HELX-agents](https://github.com/epignatelli/agentx), containing the most common RL baselines
- [HELX-envs](https://github.com/epignatelli/envx), which provides a single API to the most common RL environments (gym, gymnax, dm_env, atari, ...)
- Finally, [HELX](https://github.com/epignatelli/expx), which packs the other three nodes into a framework to run and manage experiments
Each namespace provides a single, standardised interface to all agents, environments and experiment runners.

## Installation

Expand All @@ -32,7 +33,7 @@ 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.
Expand Down Expand Up @@ -82,46 +83,47 @@ agent = helx.agents.Random(hparams)
helx.experiment.run(env, agent, episodes=100)
```

---
## Supported libraries

We currently support these external environment models:
- [dm_env](https://github.com/deepmind/dm_env)
- [bsuite](https://github.com/deepmind/bsuite)
- [dm_control](https://github.com/deepmind/dm_control), including
- [Mujoco](https://mujoco.org)
- [gym](https://github.com/openai/gym) and [gymnasium](https://github.com/Farama-Foundation/Gymnasium), including
- The [minigrid]() family
- The [minihack]() family
- The [atari](https://github.com/mgbellemare/Arcade-Learning-Environment) family
- The legacy [mujoco](https://www.roboti.us/download.html) family
- And the standard gym family
- [gym3](https://github.com/openai/gym3), including
- [procgen](https://github.com/openai/procgen)

#### On the road:
- [gymnax](https://github.com/RobertTLange/gymnax)
- [ivy_gym](https://github.com/unifyai/gym)
---
## Adding a new agent (`helx.agents.Agent`)


## Joining development

### 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.

```python
class Agent(ABC):
"""A minimal RL agent interface."""
from typing import Any
from jax import Array

from helx.base import Timestep
from helx.agents import Agent


@abstractmethod
def sample_action(self, timestep: Timestep) -> Array:
class NewAgent(helx.agents.Agent):
"""A new RL agent."""
def create(self, hparams: Any) -> None:
"""Initialises the agent's internal state (knowledge), such as a table,
or some function parameters, e.g., the parameters of a neural network."""
# implement me

def init(self, key: KeyArray, timestep: Timestep) -> None:
"""Initialises the agent's internal state (knowledge), such as a table,
or some function parameters, e.g., the parameters of a neural network."""
# implement me

def sample_action(
self, agent_state: AgentState, obs: Array, *, key: KeyArray, eval: bool = False
):
"""Applies the agent's policy to the current timestep to sample an action."""
# implement me

@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."""
# implement me
```

---

## Adding a new environment library (`helx.environment.Environment`)

To add a new library requires three steps:
Expand All @@ -148,7 +150,7 @@ If you use `helx` please consider citing it as:
}
```

---

## 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.
Expand Down
Loading
Loading