181 lines
6.6 KiB
Plaintext
181 lines
6.6 KiB
Plaintext
Metadata-Version: 2.1
|
|
Name: tensorneat
|
|
Version: 0.1.0
|
|
Summary: tensorneat
|
|
Author-email: Lishuang Wang <wanglishuang22@gmail.com>
|
|
License: BSD 3-Clause License
|
|
|
|
Copyright (c) 2024, EMI-Group
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
|
list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
this list of conditions and the following disclaimer in the documentation
|
|
and/or other materials provided with the distribution.
|
|
|
|
3. Neither the name of the copyright holder nor the names of its
|
|
contributors may be used to endorse or promote products derived from
|
|
this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Project-URL: Homepage, https://github.com/EMI-Group/tensorneat
|
|
Project-URL: Bug Tracker, https://github.com/EMI-Group/tensorneat/issues
|
|
Classifier: Programming Language :: Python :: 3
|
|
Classifier: License :: OSI Approved :: BSD License
|
|
Classifier: Intended Audience :: Science/Research
|
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
Requires-Python: >=3.9
|
|
Description-Content-Type: text/markdown
|
|
License-File: LICENSE
|
|
Requires-Dist: brax>=0.10.3
|
|
Requires-Dist: jax>=0.4.28
|
|
Requires-Dist: gymnax>=0.0.8
|
|
Requires-Dist: jaxopt>=0.8.3
|
|
Requires-Dist: optax>=0.2.2
|
|
Requires-Dist: flax>=0.8.4
|
|
Requires-Dist: mujoco>=3.1.4
|
|
Requires-Dist: mujoco-mjx>=3.1.4
|
|
|
|
<h1 align="center">
|
|
<picture>
|
|
<source media="(prefers-color-scheme: dark)" srcset="./imgs/evox_logo_dark.png">
|
|
<source media="(prefers-color-scheme: light)" srcset="./imgs/evox_logo_light.png">
|
|
<a href="https://github.com/EMI-Group/evox">
|
|
<img alt="EvoX Logo" height="50" src="./imgs/evox_logo_light.png">
|
|
</a>
|
|
</picture>
|
|
<br>
|
|
</h1>
|
|
|
|
<p align="center">
|
|
🌟 TensorNEAT: Tensorized NEAT Implementation in JAX 🌟
|
|
</p>
|
|
|
|
<p align="center">
|
|
<a href="https://arxiv.org/abs/2404.01817">
|
|
<img src="https://img.shields.io/badge/paper-arxiv-red?style=for-the-badge" alt="TensorNEAT Paper on arXiv">
|
|
</a>
|
|
</p>
|
|
|
|
## Introduction
|
|
TensorNEAT is a JAX-based libaray for NeuroEvolution of Augmenting Topologies (NEAT) algorithms, focused on harnessing GPU acceleration to enhance the efficiency of evolving neural network structures for complex tasks. Its core mechanism involves the tensorization of network topologies, enabling parallel processing and significantly boosting computational speed and scalability by leveraging modern hardware accelerators. TensorNEAT is compatible with the [EvoX](https://github.com/EMI-Group/evox/) framewrok.
|
|
|
|
## Requirements
|
|
Due to the rapid iteration of JAX versions, configuring the runtime environment for TensorNEAT can be challenging. We recommend the following versions for the relevant libraries:
|
|
|
|
- jax (0.4.28)
|
|
- jaxlib (0.4.28+cuda12.cudnn89)
|
|
- brax (0.10.3)
|
|
- gymnax (0.0.8)
|
|
|
|
We provide detailed JAX-related environment references in [recommend_environment](recommend_environment.txt). If you encounter any issues while configuring the environment yourself, you can use this as a reference.
|
|
|
|
## Example
|
|
Simple Example for XOR problem:
|
|
```python
|
|
from pipeline import Pipeline
|
|
from algorithm.neat import *
|
|
|
|
from problem.func_fit import XOR3d
|
|
|
|
if __name__ == '__main__':
|
|
pipeline = Pipeline(
|
|
algorithm=NEAT(
|
|
species=DefaultSpecies(
|
|
genome=DefaultGenome(
|
|
num_inputs=3,
|
|
num_outputs=1,
|
|
max_nodes=50,
|
|
max_conns=100,
|
|
),
|
|
pop_size=10000,
|
|
species_size=10,
|
|
compatibility_threshold=3.5,
|
|
),
|
|
),
|
|
problem=XOR3d(),
|
|
generation_limit=10000,
|
|
fitness_target=-1e-8
|
|
)
|
|
|
|
# initialize state
|
|
state = pipeline.setup()
|
|
# print(state)
|
|
# run until terminate
|
|
state, best = pipeline.auto_run(state)
|
|
# show result
|
|
pipeline.show(state, best)
|
|
```
|
|
|
|
Simple Example for RL envs in Brax (Ant):
|
|
```python
|
|
from pipeline import Pipeline
|
|
from algorithm.neat import *
|
|
|
|
from problem.rl_env import BraxEnv
|
|
from tensorneat.utils import ACT
|
|
|
|
if __name__ == '__main__':
|
|
pipeline = Pipeline(
|
|
algorithm=NEAT(
|
|
species=DefaultSpecies(
|
|
genome=DefaultGenome(
|
|
num_inputs=27,
|
|
num_outputs=8,
|
|
max_nodes=50,
|
|
max_conns=100,
|
|
node_gene=DefaultNodeGene(
|
|
activation_options=(ACT.tanh,),
|
|
activation_default=ACT.tanh,
|
|
)
|
|
),
|
|
pop_size=1000,
|
|
species_size=10,
|
|
),
|
|
),
|
|
problem=BraxEnv(
|
|
env_name='ant',
|
|
),
|
|
generation_limit=10000,
|
|
fitness_target=5000
|
|
)
|
|
|
|
# initialize state
|
|
state = pipeline.setup()
|
|
# print(state)
|
|
# run until terminate
|
|
state, best = pipeline.auto_run(state)
|
|
```
|
|
|
|
more examples are in `tensorneat/examples`.
|
|
|
|
## Community & Support
|
|
|
|
- Engage in discussions and share your experiences on [GitHub Discussion Board](https://github.com/EMI-Group/evox/discussions).
|
|
- Join our QQ group (ID: 297969717).
|
|
|
|
## Citing TensorNEAT
|
|
|
|
If you use TensorNEAT in your research and want to cite it in your work, please use:
|
|
```
|
|
@article{tensorneat,
|
|
title = {{Tensorized} {NeuroEvolution} of {Augmenting} {Topologies} for {GPU} {Acceleration}},
|
|
author = {Wang, Lishuang and Zhao, Mengfei and Liu, Enyu and Sun, Kebin and Cheng, Ran},
|
|
booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference (GECCO)},
|
|
year = {2024}
|
|
}
|