Skip to content

valentinmace/QDax

 
 

Repository files navigation

Documentation Status pytest License: MIT codecov

QDax: Accelerated Quality-Diversity

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! ⏩ ⏩ 🕛

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

Installation

The latest stable release of QDax can be installed directly from source with:

pip install git+https://github.com/adaptive-intelligent-robotics/QDax.git@main

However, we also provide and recommend using either Docker, Singularity or conda environments to use the repository. Detailed steps to do so are available in the documentation.

Basic API Usage

For a full and interactive example to see how QDax works, we recommend starting with the tutorial-style Colab notebook. It is an example of the MAP-Elites algorithm used to evolve a population of controllers on a chosen Brax environment (Walker by default).

However, a summary of the main API usage is provided below:

import qdax
from qdax.core.map_elites import MAPElites

# Instantiate MAP-Elites
map_elites = MAPElites(
    scoring_function=scoring_fn,
    emitter=mixing_emitter,
    metrics_function=metrics_function,
)

# Initializes repertoire and emitter state
repertoire, emitter_state, random_key = map_elites.init(init_variables, centroids, random_key)

# Run MAP-Elites loop
for i in range(num_iterations):
    (repertoire, emitter_state, metrics, random_key,) = map_elites.update(
            repertoire,
            emitter_state,
            random_key,
        )

# Get contents of repertoire
repertoire.genotypes, repertoire.fitnesses, repertoire.descriptors

QDax core algorithms

QDax currently supports the following algorithms:

Algorithm Example
MAP-Elites Open All Collab
CVT MAP-Elites Open All Collab
Policy Gradient Assisted MAP-Elites (PGA-ME) Open All Collab
OMG-MEGA Open All Collab
CMA-MEGA Open All Collab
Multi-Objective Quality-Diversity (MOME) Open All Collab

QDax baseline algorithms

The QDax library also provides implementations for some useful baseline algorithms:

Algorithm Example
DIAYN Open All Collab
DADS Open All Collab
SMERL Open All Collab
NSGA2 Open All Collab
SPEA2 Open All Collab

Contributing

Issues and contributions are welcome. Please refer to the contribution guide in the documentation for more details.

Related Projects

Citing QDax

If you use QDax in your research and want to cite it in your work, please use:

@article{lim2022accelerated,
  title={Accelerated Quality-Diversity for Robotics through Massive Parallelism},
  author={Lim, Bryan and Allard, Maxime and Grillotti, Luca and Cully, Antoine},
  journal={arXiv preprint arXiv:2202.01258},
  year={2022}
}

Contributors

QDax was developed and is maintained by the Adaptive & Intelligent Robotics Lab (AIRL) and InstaDeep.

AIRL_Logo InstaDeep_Logo

Packages

No packages published

Languages

  • Python 78.4%
  • Jupyter Notebook 20.8%
  • Other 0.8%