Skip to content

Commit e8ce2f0

Browse files
Lookatatormaxencefaldorhannah-janfelixchalumeaumanon-but-yes
authored
Release v0.5.0 - Major framework overhaul with enhanced flexibility and performance
- Add custom repertoire integration (#222) and ask/tell interface (#221) for improved flexibility - Refactor selector system (#209) with unified abstraction and sub-repertoire returns - Restructure Brax environments (#236) with v1/v2 support and proper versioning - Optimize VRAM usage (#224) in PGA/DCRL algorithms with shared mini-batches - Standardize terminology (#190) (descriptor naming, JAX random keys, function signatures) - Remove JIT decorators (#232) from internal functions for user coding flexibility - Modernize packaging (#213) (setup.py → pyproject.toml) and add automated spell checking (#194) - Enhance metrics (#186) with uncertainty domain support and custom visualization (#233) - Simplify repertoire interface (#225) by removing save/load methods - Add comprehensive test coverage and update example notebooks (#231) - Code organization improvements (#200, #204) and JAX modernization (#195) - Fix UnstructuredRepertoire indexing (#185) and add legacy spring support (#226) - Return metrics after repertoire initialization (#214) and enhance MAPElites (#211) BREAKING CHANGES: - Repertoire save/load methods removed (use pickle/orbax instead) - Brax environments moved from /environments to /tasks/brax - Descriptor terminology standardized across codebase - JAX random key handling updated to new-style keys --------- Co-authored-by: Maxence Faldor <[email protected]> Co-authored-by: Hannah Janmohamed <[email protected]> Co-authored-by: Felix Chalumeau <[email protected]> Co-authored-by: Manon Flageat <[email protected]> Co-authored-by: LisaCoiffard <[email protected]> Co-authored-by: Milton Montero <[email protected]> Co-authored-by: Jeroen Van Goey <[email protected]> Co-authored-by: Maxence Faldor <[email protected]> Co-authored-by: lc1021 <[email protected]> Co-authored-by: TemplierPaul <[email protected]> Co-authored-by: Paul Templier <[email protected]> Co-authored-by: Runjun Mao <[email protected]>
1 parent 22f2b4e commit e8ce2f0

File tree

179 files changed

+8370
-5544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+8370
-5544
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ hydra_outputs/
2828

2929
# Usual python .gitignore
3030

31+
# Mac OS X files
32+
.DS_Store
33+
3134
# Byte-compiled / optimized / DLL files
3235
__pycache__/
3336
*.py[cod]
@@ -166,3 +169,6 @@ dmypy.json
166169

167170
# Cython debug symbols
168171
cython_debug/
172+
173+
# HTML files
174+
*.html

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ repos:
4545
rev: v1.11.2
4646
hooks:
4747
- id: mypy
48+
49+
- repo: https://github.com/codespell-project/codespell
50+
rev: v2.3.0
51+
hooks:
52+
- id: codespell
53+
name: codespell
54+
description: Checks for common misspellings in text files.
55+
entry: codespell
56+
language: python
57+
types: [text]

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[![codecov](https://codecov.io/gh/adaptive-intelligent-robotics/QDax/branch/feat/add-codecov/graph/badge.svg)](https://codecov.io/gh/adaptive-intelligent-robotics/QDax)
1212

1313

14-
QDax is a tool to accelerate Quality-Diversity (QD) and neuro-evolution algorithms through hardware accelerators and massive parallelization. QD algorithms usually take days/weeks to run on large CPU clusters. With QDax, QD algorithms can now be run in minutes! ⏩ ⏩ 🕛
14+
QDax is a tool to accelerate Quality-Diversity (QD) and neuroevolution algorithms through hardware accelerators and massive parallelization. QD algorithms usually take days/weeks to run on large CPU clusters. With QDax, QD algorithms can now be run in minutes! ⏩ ⏩ 🕛
1515

1616
QDax has been developed as a research framework: it is flexible and easy to extend and build on and can be used for any problem setting. Get started with simple example and run a QD algorithm in minutes here! [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adaptive-intelligent-robotics/QDax/blob/main/examples/mapelites.ipynb)
1717

@@ -60,14 +60,14 @@ num_iterations = 50
6060
grid_shape = (100, 100)
6161
min_param = 0.0
6262
max_param = 1.0
63-
min_bd = 0.0
64-
max_bd = 1.0
63+
min_descriptor = 0.0
64+
max_descriptor = 1.0
6565

6666
# Init a random key
67-
random_key = jax.random.PRNGKey(seed)
67+
key = jax.random.key(seed)
6868

6969
# Init population of controllers
70-
random_key, subkey = jax.random.split(random_key)
70+
key, subkey = jax.random.split(key)
7171
init_variables = jax.random.uniform(
7272
subkey,
7373
shape=(init_batch_size, num_param_dimensions),
@@ -106,19 +106,21 @@ map_elites = MAPElites(
106106
# Compute the centroids
107107
centroids = compute_euclidean_centroids(
108108
grid_shape=grid_shape,
109-
minval=min_bd,
110-
maxval=max_bd,
109+
minval=min_descriptor,
110+
maxval=max_descriptor,
111111
)
112112

113113
# Initializes repertoire and emitter state
114-
repertoire, emitter_state, random_key = map_elites.init(init_variables, centroids, random_key)
114+
key, subkey = jax.random.split(key)
115+
repertoire, emitter_state, metrics = map_elites.init(init_variables, centroids, subkey)
115116

116117
# Run MAP-Elites loop
117118
for i in range(num_iterations):
118-
(repertoire, emitter_state, metrics, random_key,) = map_elites.update(
119+
key, subkey = jax.random.split(key)
120+
(repertoire, emitter_state, metrics,) = map_elites.update(
119121
repertoire,
120122
emitter_state,
121-
random_key,
123+
subkey,
122124
)
123125

124126
# Get contents of repertoire
@@ -133,6 +135,7 @@ QDax currently supports the following algorithms:
133135
| Algorithm | Example |
134136
|-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
135137
| [MAP-Elites](https://arxiv.org/abs/1504.04909) | [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adaptive-intelligent-robotics/QDax/blob/main/examples/mapelites.ipynb) |
138+
| [AURORA](https://arxiv.org/abs/2106.05648) | [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adaptive-intelligent-robotics/QDax/blob/main/examples/aurora.ipynb) |
136139
| [CVT MAP-Elites](https://arxiv.org/abs/1610.05729) | [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adaptive-intelligent-robotics/QDax/blob/main/examples/mapelites.ipynb) |
137140
| [Policy Gradient Assisted MAP-Elites (PGA-ME)](https://hal.archives-ouvertes.fr/hal-03135723v2/file/PGA_MAP_Elites_GECCO.pdf) | [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adaptive-intelligent-robotics/QDax/blob/main/examples/pgame.ipynb) |
138141
| [DCRL-ME](https://arxiv.org/abs/2401.08632) | [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adaptive-intelligent-robotics/QDax/blob/main/examples/dcrlme.ipynb) |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# CMAES class
22

3-
::: qdax.core.cmaes.CMAES
3+
::: qdax.baselines.cmaes.CMAES
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# Emitters
22

33
::: qdax.core.emitters
4+
5+
The emitters module also contains repertoire selectors in the `qdax.core.emitters.repertoire_selectors` submodule. These selectors are used by emitters to select individuals from the repertoire for mutation and crossover operations.
6+
7+
::: qdax.core.emitters.repertoire_selectors

docs/api_documentation/core/mels.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
[ME-LS](https://dl.acm.org/doi/abs/10.1145/3583131.3590433) is a variant of
44
MAP-Elites that thrives the search process towards solutions that are consistent
5-
in the behavior space for uncertain domains.
5+
in the descriptor space for uncertain domains.
66

77
::: qdax.core.mels.MELS

docs/api_documentation/core/pbt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[PBT](https://arxiv.org/abs/1711.09846) is optimization method to jointly optimise a population of models and their hyperparameters to maximize performance.
44

5-
To use PBT in QDax to train SAC, one can use the two following components (see [examples](../../examples/sac_pbt.ipynb) to see how to use the components appropriatly):
5+
To use PBT in QDax to train SAC, one can use the two following components (see [examples](../../examples/sac_pbt.ipynb) to see how to use the components appropriately):
66

77
::: qdax.baselines.sac_pbt.PBTSAC
88

docs/api_documentation/environments.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/overview.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# QDax Overview
22

3-
QDax has been designed to be modular yet flexible so it's easy for anyone to use and extend on the different state-of-the-art QD algortihms available.
3+
QDax has been designed to be modular yet flexible so it's easy for anyone to use and extend on the different state-of-the-art QD algorithms available.
44
For instance, MAP-Elites is designed to work with a few modular and simple components: `container`, `emitter`, and `scoring_function`.
55

66
## Key concepts
@@ -17,23 +17,23 @@ The `scoring_function` defines the problem/task we want to solve and functions t
1717
With this modularity, a user can easily swap out any one of the components and pass it to the `MAPElites` class, avoiding having to re-implement all the steps of the algorithm.
1818

1919
Under one layer of abstraction, users have a bit more flexibility. QDax has similarities to the simple and commonly found `ask`/`tell` interface. The `ask` function is similar to the `emit` function in QDax and the `tell` function is similar to the `update` function in QDax. Likewise, the `eval` of solutions is analogous to the `scoring function` in QDax.
20-
More importantly, QDax handles the archive management which is the key idea of QD algorihtms and not present or needed in standard optimization algorihtms or evolutionary strategies.
20+
More importantly, QDax handles the archive management which is the key idea of QD algorithms and not present or needed in standard optimization algorithms or evolutionary strategies.
2121

2222
## Code Example
2323
```python
2424
# Initializes repertoire and emitter state
25-
repertoire, emitter_state, random_key = map_elites.init(init_variables, centroids, random_key)
25+
repertoire, emitter_state, key = map_elites.init(init_variables, centroids, key)
2626

2727
for i in range(num_iterations):
2828

2929
# generate new population with the emitter
30-
genotypes, random_key = map_elites._emitter.emit(
31-
repertoire, emitter_state, random_key
30+
genotypes, key = map_elites._emitter.emit(
31+
repertoire, emitter_state, key
3232
)
3333

3434
# scores/evaluates the population
35-
fitnesses, descriptors, extra_scores, random_key = map_elites._scoring_function(
36-
genotypes, random_key
35+
fitnesses, descriptors, extra_scores, key = map_elites._scoring_function(
36+
genotypes, key
3737
)
3838

3939
# update repertoire

0 commit comments

Comments
 (0)