RobertTLange/gymnax
RL Environments in JAX 🌍
What it solves
Gymnax addresses the bottleneck of slow, CPU-based reinforcement learning (RL) environment processes. It allows researchers to run environment transitions and policies on accelerators (GPUs/TPUs) to achieve high-throughput experiments and massive vectorization.
How it works
It reimplements classic RL environments (such as those from OpenAI Gym) using JAX. By doing so, it brings JAX primitives like jit (just-in-time compilation), vmap (vectorized mapping), and pmap (parallel mapping) to the environment API. This allows for the execution of both the environment and the policy on the same accelerator, enabling fast parallelized rollouts and functional control over environment settings like random seeds and hyperparameters.
Who it’s for
It is designed for RL researchers and developers who need high-performance environment simulation, specifically those working on meta-RL, evolutionary optimization, or distributed architectures like the Anakin sub-architecture.
Highlights
- Accelerated Environments: Includes implementations of classic control, bsuite, MinAtar, and various meta-RL tasks.
- JAX Integration: Full support for
jit,vmap, andpmapfor massive vectorization across random keys or environment parameters. - Differentiable Transitions: Opt-in support for JAX gradients in continuous-control environments (e.g., Pendulum, MountainCarContinuous).
- Fast Rollouts: Supports
lax.scanfor compiling entire episode loops into a single accelerator operation. - Auto-reset: Implements an automatic reset behavior after terminal or truncated steps.
Related
- Project
- Project
- Project
- Project
- Project