Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.9%) to scientific vocabulary
Keywords
Repository
Accelerated minigrid environments with JAX
Basic Info
Statistics
- Stars: 144
- Watchers: 4
- Forks: 21
- Open Issues: 11
- Releases: 44
Topics
Metadata Files
README.md
What is NAVIX?
NAVIX is a JAX-powered reimplementation of MiniGrid. Experiments that took 1 week, now take 15 minutes.
200 000x speedups compared to MiniGrid and 670 Million steps/s are not just a speed improvements. They produce a whole new paradigm that grants access to experiments that were previously impossible, e.g., those taking years to run.
It changes the game.
Check out the NAVIX performance more in detail and the documentation for more information.
Key features: - Performance Boost: NAVIX offers over 1000x speed increase compared to the original Minigrid implementation, enabling faster experimentation and scaling. You can see a preliminary performance comparison here, and a full benchmarking at here. - XLA Compilation: Leverage the power of XLA to optimize NAVIX computations for many accelerators. NAVIX can run on CPU, GPU, and TPU. - Autograd Support: Differentiate through environment transitions, opening up new possibilities such as learned world models. - Batched hyperparameter tuning: run thousands of experiments in parallel, enabling hyperparameter tuning at scale. Clear your doubts instantly if your algorithm doesn't work because of the hyperparameters choice. - It allows finally focus on the method research, and not the engineering.
The library is in active development, and we are working on adding more environments and features. If you want join the development and contribute, please open a discussion and let's have a chat!
Installation
Install JAX
Follow the official installation guide for your OS and preferred accelerator: https://github.com/google/jax#installation.
Install NAVIX
bash
pip install navix
Or, for the latest version from source:
bash
pip install git+https://github.com/epignatelli/navix
Performance
NAVIX improves MiniGrid both in execution speed and throughput, allowing to run more than 2048 PPO agents in parallel almost 10 times faster than a single PPO agent in the original MiniGrid.
NAVIX performs 2048 × 1M/49s = 668 734 693.88 steps per second (∼ 670 Million steps/s) in batch mode,
while the original Minigrid implementation performs 1M/318.01 = 3 144.65 steps per second. This
is a speedup of over 200 000×.
Examples
You can view a full set of examples here (more coming), but here are the most common use cases.
Compiling a collection step
```python import jax import navix as nx import jax.numpy as jnp
def run(seed): env = nx.make('MiniGrid-Empty-8x8-v0') # Create the environment key = jax.random.PRNGKey(seed) timestep = env.reset(key) actions = jax.random.randint(key, (NTIMESTEPS,), 0, env.actionspace.n)
def body_fun(timestep, action): timestep = env.step(action) # Update the environment state return timestep, ()
return jax.lax.scan(body_fun, timestep, actions)[0]
Compile the entire training run for maximum performance
final_timestep = jax.jit(jax.vmap(run))(jnp.arange(1000)) ```
Compiling a full training run
```python import jax import navix as nx import jax.numpy as jnp from jax import random
def runepisode(seed, env, policy): """Simulates a single episode with a given policy""" key = random.PRNGKey(seed) timestep = env.reset(key) done = False totalreward = 0
while not done:
action = policy(timestep.observation)
timestep, reward, done, _ = env.step(action)
total_reward += reward
return total_reward
def trainpolicy(policy, numepisodes): """Trains a policy over multiple parallel episodes""" envs = jax.vmap(nx.make, inaxes=0)(['MiniGrid-MultiRoom-N2-S4-v0'] * numepisodes) seeds = random.split(random.PRNGKey(0), num_episodes)
# Compile the entire training loop with XLA
compiled_episode = jax.jit(run_episode)
compiled_train = jax.jit(jax.vmap(compiled_episode, in_axes=(0, 0, None)))
for _ in range(num_episodes):
rewards = compiled_train(seeds, envs, policy)
# ... Update the policy based on rewards ...
Hypothetical policy function
def policy(observation): # ... your policy logic ... return action
Start the training
trainpolicy(policy, numepisodes=100) ```
Backpropagation through the environment
```python import jax import navix as nx import jax.numpy as jnp from jax import grad from flax import struct
class Model(struct.PyTreeNode): @nn.compact def call(self, x): # ... your NN here
model = Model() env = nx.environments.Room(16, 16, 8)
def loss(params, timestep): action = jnp.asarray(0) predobs = model.apply(timestep.observation) timestep = env.step(timestep, action) return jnp.square(timestep.observation - predobs).mean()
key = jax.random.PRNGKey(0) timestep = env.reset(key) params = model.init(key, timestep.observation)
gradients = grad(loss)(params, timestep) ```
JAX ecosystem for RL
NAVIX is not alone and part of an ecosystem of JAX-powered modules for RL. Check out the following projects: - Environments: - Gymnax: a broad range of RL environments - Brax: a physics engine for robotics experiments - EnvPool: a set of various batched environments - Craftax: a JAX reimplementation of the game of Crafter - Jumanji: another set of diverse environments - PGX: board games commonly used for RL, such as backgammon, chess, shogi, and go - JAX-MARL: multi-agent RL environments in JAX - Xland-Minigrid: a set of JAX-reimplemented grid-world environments - Minimax: a JAX library for RL autocurricula with 120x faster baselines - Agents: - PureJaxRl: proposing fullly-jitten training routines - Rejax: a suite of diverse agents, among which, DDPG, DQN, PPO, SAC, TD3 - Stoix: useful implementations of popular single-agent RL algorithms in JAX - JAX-CORL: lean single-file implementations of offline RL algorithms with solid performance reports - Dopamine: a research framework for fast prototyping of reinforcement learning algorithms
Join Us!
NAVIX is actively developed. If you'd like to contribute to this open-source project, we welcome your involvement! Start a discussion or open a pull request.
Please, consider starring the project if you like NAVIX!
Cite us, please!
If you use NAVIX please cite it as:
bibtex
@article{pignatelli2024navix,
title={NAVIX: Scaling MiniGrid Environments with JAX},
author={Pignatelli, Eduardo and Liesen, Jarek and Lange, Robert Tjarko and Lu, Chris and Castro, Pablo Samuel and Toni, Laura},
journal={arXiv preprint arXiv:2407.19396},
year={2024}
}
Owner
- Name: Eduardo Pignatelli
- Login: epignatelli
- Kind: user
- Location: London
- Company: University College London (UCL)
- Website: https://epignatelli.com
- Twitter: EduPignatelli
- Repositories: 116
- Profile: https://github.com/epignatelli
Assistant Professor (UK Lecturer, Teaching) @ UCL. PhD @ UCL. Previously ML Lead at @BuroHappoldEngineering and RA at @ImperialCollegeLondon
Citation (CITATION.cff)
cff-version: 1.2.0
title: >-
Navix: Accelerated gridworld navigation with JAX
type: software
authors:
- family-names: Pignatelli
given-names: Eduardo
email: edu.pignatelli@gmail.com
affiliation: University College London (UCL)
orcid: 'https://orcid.org/0000-0003-0730-2303'
identifiers:
- type: url
value: 'https://github.com/epignatelli/navix'
repository-code: 'https://github.com/epignatelli/navix'
keywords:
- Reinforcement Learning
- JAX
- Minigrid
license: Apache-2.0
GitHub Events
Total
- Create event: 6
- Release event: 4
- Issues event: 9
- Watch event: 32
- Delete event: 5
- Issue comment event: 24
- Push event: 27
- Pull request review comment event: 8
- Pull request review event: 10
- Pull request event: 11
- Fork event: 10
Last Year
- Create event: 6
- Release event: 4
- Issues event: 9
- Watch event: 32
- Delete event: 5
- Issue comment event: 24
- Push event: 27
- Pull request review comment event: 8
- Pull request review event: 10
- Pull request event: 11
- Fork event: 10
Committers
Last synced: 11 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| epignatelli | e****i@g****m | 399 |
| Chris Lu | l****9@g****m | 3 |
| Conventional Changelog Action | c****n@g****m | 2 |
| James Doran | j****n@g****m | 1 |
| Alan Guedes | a****o@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 34
- Total pull requests: 87
- Average time to close issues: 2 months
- Average time to close pull requests: 2 days
- Total issue authors: 12
- Total pull request authors: 6
- Average comments per issue: 0.38
- Average comments per pull request: 0.92
- Merged pull requests: 79
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 10
- Pull requests: 9
- Average time to close issues: 22 days
- Average time to close pull requests: about 23 hours
- Issue authors: 9
- Pull request authors: 4
- Average comments per issue: 0.2
- Average comments per pull request: 0.67
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- epignatelli (22)
- adzcai (2)
- timoklein (1)
- rikifunt (1)
- astanziola (1)
- fernando-ml (1)
- antoine-dedieu (1)
- danieljarne (1)
- brunoleej (1)
- MathisFederico (1)
- annasoligo (1)
- EdanToledo (1)
Pull Request Authors
- epignatelli (79)
- timoklein (2)
- keraJLi (2)
- luchris429 (2)
- Copilot (1)
- jysdoran (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 968 last-month
-
Total dependent packages: 3
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 51
- Total maintainers: 1
proxy.golang.org: github.com/epignatelli/navix
- Documentation: https://pkg.go.dev/github.com/epignatelli/navix#section-documentation
- License: apache-2.0
-
Latest release: v0.8.0
published 6 months ago
Rankings
pypi.org: navix
Accelerated gridworld navigation with JAX for deep reinforcement learning
- Documentation: https://navix.readthedocs.io/
- License: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [2023] The Helx Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Latest release: 0.7.3
published 6 months ago
Rankings
Maintainers (1)
Dependencies
- TriPSs/conventional-changelog-action v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- ncipollo/release-action v1 composite
- pypa/gh-action-pypi-publish release/v1 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- mshick/add-pr-comment v2 composite
- absl-py *
- black *
- chex *
- etils *
- flake8 *
- flax *
- jax *
- numpy *
- pylint *
- pytest *
- setuptools_scm *
- typing-extensions *