Skip to main content

Environments for Generative Flow Networks in JAX

Project description

gfnx: Generative Flow Networks in jaX

gfnx is a JAX-native toolkit for building and studying Generative Flow Networks (GFlowNets). It brings together a collection of benchmark environments and reproducible baselines so you can iterate quickly on new ideas.

Highlights

  • End-to-end JAX implementations of GFlowNet building blocks (environments, reward modules, networks, and metrics).
  • Ready-to-run baseline agents inspired by the CleanRL style of concise single-file experiments.
  • Utilities for logging, checkpointing, and evaluation that make it easy to compare runs and extend the library with new research code.

Installation

Requirements

Install the latest release

pip install git+https://github.com/d-tiapkin/gfnx.git

Verify the install with:

python -c "import gfnx; print('gfnx import OK')"

Develop locally and run baselines

git clone https://github.com/d-tiapkin/gfnx.git
cd gfnx
pip install -e .[baselines]

The editable install keeps your local changes in sync with the Python package, while the optional baselines extra pulls in the dependencies required by the reference training scripts. As in with CleanRL ideology, the baselines are not supposed to be imported, they serve only as a reference implementation.

Quickstart

Kick off a short training run of Detailed Balance in the Hypergrid environment:

python baselines/db_hypergrid.py num_train_steps=1_000 logging.tqdm_print_rate=100

The script is powered by Hydra, so you can override any configuration value on the command line (for example, picking another logging backend or playing with hyperparameters of the method). Baseline outputs, checkpoints, and Hydra logs default to tmp/<date>/<time>/; point the logging.log_dir or logging.checkpoint_dir fields to custom paths when running longer experiments.

Support

  • Open an issue on GitHub for bugs or feature requests.
  • Start a discussion or reach out via pull requests if you would like to contribute improvements. Contributions with reproducible experiments and clear documentation get merged fastest.

License

gfnx is released under the MIT License. Feel free to use it in academic and commercial projects; please attribute the original authors when you publish results built on this codebase.

Influences

gfnx stands on the shoulders of several excellent open-source projects:

  • torchgfn – PyTorch-first GFlowNet library that shaped our environment design.
  • CleanRL – taught us the value of single-file baselines and reproducible experiment configs.
  • purejaxrl and JaxMARL – reference points for idiomatic, accelerator-ready JAX reinforcement learning code.

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

gfnx-0.0.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gfnx-0.0.1-py3-none-any.whl (103.8 kB view details)

Uploaded Python 3

File details

Details for the file gfnx-0.0.1.tar.gz.

File metadata

  • Download URL: gfnx-0.0.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for gfnx-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1ade300aa3e107b5b0a2b72e90c53bff44e8c84383214f739d2afeaffe1fd6b4
MD5 c896f489d3b0037d3c1c0e45dc4574df
BLAKE2b-256 24c6e647f6038a721296b84eb9625683f227bce3883820c535dc0ad86d0ec675

See more details on using hashes here.

File details

Details for the file gfnx-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gfnx-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 103.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for gfnx-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46deb22d09785fbc275db1905360eead7718df6e94ce2897a3f94b152ef186ba
MD5 ba782da89d46fe3519e35379c6a41d62
BLAKE2b-256 861a6a79f7913cd6474bedb7a7f7c5cd439a5b8b072c3629837aad89e0490046

See more details on using hashes here.

Supported by

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