Skip to main content

A differentiable physics engine written in JAX.

Project description

BRAX

Brax is a differentiable physics engine that simulates environments made up of rigid bodies, joints, and actuators. Brax is written in JAX and is designed for use on acceleration hardware. It is both efficient for single-device simulation, and scalable to massively parallel simulation on multiple devices, without the need for pesky datacenters.

Some policies trained via Brax. Brax simulates these environments at millions of physics steps per second on TPU.

Brax also includes a suite of learning algorithms that train agents in seconds to minutes:

Quickstart: Colab in the Cloud

Explore Brax easily and quickly through a series of colab notebooks:

  • Brax Basics introduces the Brax API, and shows how to simulate basic physics primitives.
  • Brax Environments shows how to operate and visualize Brax environments. It also demonstrates converting Brax environments to Gym environments, and how to use Brax via other ML frameworks such as PyTorch.
  • Brax Training with TPU introduces Brax's training algorithms, and lets you train your own policies directly within the colab. It also demonstrates loading and saving policies.
  • Brax Training with PyTorch on GPU demonstrates how Brax can be used in other ML frameworks for fast training, in this case PyTorch.
  • Brax Multi-Agent measures Brax's performance on multi-agent simulation, with many bodies in the environment at once.

Using Brax locally

To install Brax from pypi, install it with:

python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install brax

You may also install from Conda or Mamba:

conda install -c conda-forge brax  # s/conda/mamba for mamba

Alternatively, to install Brax from source, clone this repo, cd to it, and then:

python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install -e .

To train a model:

learn

Training on NVidia GPU is supported, but you must first install CUDA, CuDNN, and JAX with GPU support.

Learn More

For a deep dive into Brax's design and performance characteristics, please see our paper, Brax -- A Differentiable Physics Engine for Large Scale Rigid Body Simulation , which appeared in the Datasets and Benchmarks Track at NeurIPS 2021.

Citing Brax

If you would like to reference Brax in a publication, please use:

@software{brax2021github,
  author = {C. Daniel Freeman and Erik Frey and Anton Raichuk and Sertan Girgin and Igor Mordatch and Olivier Bachem},
  title = {Brax - A Differentiable Physics Engine for Large Scale Rigid Body Simulation},
  url = {http://github.com/google/brax},
  version = {0.1.2},
  year = {2021},
}

Acknowledgements

Brax has come a long way since its original publication. We offer gratitude and effusive praise to the following people:

  • Manu Orsini and Nikola Momchev who provided a major refactor of Brax's training algorithms to make them more accessible and reusable.
  • Erwin Coumans who has graciously offered advice and mentorship, and many useful references from Tiny Differentiable Simulator.
  • Baruch Tabanpour, a colleague who is making Brax much more reliable and feature-complete.
  • Shixiang Shane Gu and Hiroki Furuta, who contributed BIG-Gym and Braxlines, and a scene composer to Brax.
  • Our awesome open source collaborators and contributors. Thank you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brax-0.1.2.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

brax-0.1.2-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file brax-0.1.2.tar.gz.

File metadata

  • Download URL: brax-0.1.2.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for brax-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ebc6b543c66af3f7fc6b13e5e4dfe0094f960416fb4b445bec7be1283c807101
MD5 f8ed90e0930ad8116f74c876f850a469
BLAKE2b-256 4504eeb003c4302921b8c0d1aff767ca213b0f73c08082760b33a58e0d8db836

See more details on using hashes here.

Provenance

File details

Details for the file brax-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: brax-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for brax-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e08789972f12bbc3d364da761c6d11e6d5bafb443d22819e0f6558a3aae1f9f6
MD5 dd1a357697b3200af01023fe6a48bde1
BLAKE2b-256 47f3a98a37a5d89019db0b0ae5f360ae817003f876fbb136dcba40daf1828406

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page