{"id":28940542,"url":"https://github.com/aurelio-amerio/gensbi","last_synced_at":"2026-03-03T18:05:47.210Z","repository":{"id":298897280,"uuid":"958702117","full_name":"aurelio-amerio/GenSBI","owner":"aurelio-amerio","description":"A JAX machine learning library to connect generative models with scientific discovery","archived":false,"fork":false,"pushed_at":"2026-02-24T10:38:11.000Z","size":149043,"stargazers_count":8,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T15:08:53.221Z","etag":null,"topics":["density-estimation","diffusion-models","flax","flow-matching","jax","sbi"],"latest_commit_sha":null,"homepage":"https://gensbi.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aurelio-amerio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-01T16:14:51.000Z","updated_at":"2026-02-23T16:03:59.000Z","dependencies_parsed_at":"2025-09-22T17:31:37.172Z","dependency_job_id":"9fe92f40-781f-4162-873a-82757ec4041e","html_url":"https://github.com/aurelio-amerio/GenSBI","commit_stats":null,"previous_names":["aurelio-amerio/gen-sbi","aurelio-amerio/gensbi"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aurelio-amerio/GenSBI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurelio-amerio%2FGenSBI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurelio-amerio%2FGenSBI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurelio-amerio%2FGenSBI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurelio-amerio%2FGenSBI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aurelio-amerio","download_url":"https://codeload.github.com/aurelio-amerio/GenSBI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurelio-amerio%2FGenSBI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30018567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T17:00:27.440Z","status":"ssl_error","status_checked_at":"2026-03-02T17:00:03.402Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["density-estimation","diffusion-models","flax","flow-matching","jax","sbi"],"created_at":"2025-06-23T01:30:40.485Z","updated_at":"2026-03-03T18:05:47.205Z","avatar_url":"https://github.com/aurelio-amerio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GenSBI\n\n[![Build](https://github.com/aurelio-amerio/GenSBI/actions/workflows/python-app.yml/badge.svg)](https://github.com/aurelio-amerio/GenSBI/actions/workflows/python-app.yml)\n![Coverage](https://raw.githubusercontent.com/aurelio-amerio/GenSBI/refs/heads/main/img/badges/coverage.svg)\n[![Version](https://img.shields.io/pypi/v/gensbi.svg?maxAge=3600)](https://pypi.org/project/gensbi/)\n[![Downloads](https://pepy.tech/badge/gensbi)](https://pepy.tech/project/gensbi)\n\n![GenSBI Logo](https://raw.githubusercontent.com/aurelio-amerio/GenSBI/refs/heads/main/docs/_static/logo.png)\n\n\u003e [!IMPORTANT]  \n\u003e This library is at an early stage of development. The API is currently stable, but it is subject to change.\n\n## Overview\n\n**GenSBI** is a powerful JAX-based library for Simulation-Based Inference (SBI) using state-of-the-art generative models, currently revolving around Optimal Transport Flow Matching and Diffusion Models.\n\nIt is designed for researchers and practitioners who need a flexible, high-performance toolkit to solve complex inference problems where the likelihood function is intractable.\n\n## Key Features\n\n- **Modern SBI Algorithms**: Implements cutting-edge techniques like **Optimal Transport Conditional Flow Matching** and **Diffusion Models** for robust and flexible posterior inference.\n- **Built on JAX and Flax NNX**: Leverages the power of JAX for automatic differentiation, vectorization, and seamless execution on CPUs, GPUs, and TPUs.\n- **High-Level Recipes API**: A simplified interface for common workflows, allowing you to train models and run inference with just a few lines of code.\n- **Powerful Transformer Models**: Includes implementations of recent, high-performing models like **Flux1**, **Flux1Join**, and **Simformer** for handling complex, high-dimensional data.\n- **Modular and Extensible**: A clean, well-structured codebase that is easy to understand, modify, and extend for your own research.\n\n## Installation\n\nUsing [uv](https://docs.astral.sh/uv/) (recommended):\n\n```bash\nuv add gensbi\n# or, for a standalone install:\nuv pip install gensbi\n```\n\nFor GPU support:\n\n```bash\nuv add gensbi[cuda12]\n# or\nuv pip install gensbi[cuda12]\n```\n\nOr using pip:\n\n```bash\npip install gensbi\n```\n\nFor GPU support and other options, including how to install `uv`, see the [Installation Guide](https://aurelio-amerio.github.io/GenSBI/getting_started/installation.html).\n\n## Quick Start\n\nTo get started immediately, you can use the high-level API to train a model.\n\n\u003e [!TIP]\n\u003e Check out the **[my_first_model.ipynb](https://github.com/aurelio-amerio/GenSBI-examples/blob/main/examples/getting_started/my_first_model.ipynb)** notebook for a complete, step-by-step introductory tutorial.\n\n```python\nfrom flax import nnx\nfrom gensbi.recipes import Flux1FlowPipeline\nfrom gensbi.models import Flux1Params\n\ntrain_dataset = ... # define a training dataset (infinite iterator)\nval_dataset = ...   # define a validation dataset (infinite iterator)\ndim_obs = ...       # dimension of the parameters (theta)\ndim_cond = ...      # dimension of the simulator observations (x)\nparams = Flux1Params(...) # the parameters for your model\n\n# Instantiate the pipeline\npipeline = Flux1FlowPipeline(\n    train_dataset,\n    val_dataset,\n    dim_obs,\n    dim_cond,\n    params=params,\n)\n\n# Train the model\n# Note: GenSBI uses Flax NNX, so we pass a random key generator\npipeline.train(rngs=nnx.Rngs(0))\n\n# After training, get a sampler for posterior sampling\nkey = jax.random.PRNGKey(42)\nsamples = pipeline.sample(key, x_observed, num_samples=10_000)\n```\n\n## Examples\n\n\u003c!-- \u003ctable align=\"center\" style=\"width:95%;\"\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg src=\"https://github.com/aurelio-amerio/GenSBI-examples/blob/main/examples/sbi-benchmarks/two_moons/flow_simformer/animated_plot_samples_simformer.gif?raw=true\" alt=\"two-moons posterior sampling\" height=\"300\"\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg src=\"https://github.com/aurelio-amerio/GenSBI-examples/blob/main/examples/sbi-benchmarks/two_moons/flow_simformer/animated_plot_posterior_simformer.gif?raw=true\" alt=\"two-moons posterior sampling\" height=\"300\"\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e --\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/aurelio-amerio/GenSBI-examples/refs/heads/main/examples/NDE/gensbi_animation_small.gif\" width=600px\u003e\n\nExamples for this library are available separately in the [GenSBI-examples](https://github.com/aurelio-amerio/GenSBI-examples) repository.\n\nSome key examples include:\n\n**Getting Started:**\n\n- `my_first_model.ipynb` [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/aurelio-amerio/GenSBI-examples/blob/main/examples/getting_started/my_first_model.ipynb) \u003cbr\u003e\nA beginner-friendly notebook introducing the core concepts of GenSBI on a simple problem.\n\n**Unconditional Density Estimation:**\n\n- `flow_matching_2d_unconditional.ipynb` [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/aurelio-amerio/GenSBI-examples/blob/main/examples/NDE/flow_matching_2d_unconditional.ipynb) \u003cbr\u003e\nDemonstrates how to use flow matching in 2D for unconditional density estimation.\n- `diffusion_2d_unconditional.ipynb` [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/aurelio-amerio/GenSBI-examples/blob/main/examples/NDE/diffusion_2d_unconditional.ipynb) \u003cbr\u003e\nDemonstrates how to use diffusion models in 2D for unconditional density estimation.\n\n**Conditional Density Estimation:**\n- `two_moons_flow_flux.ipynb` [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/aurelio-amerio/GenSBI-examples/blob/main/examples/sbi-benchmarks/two_moons/flow_flux/two_moons_flow_flux.ipynb) \u003cbr\u003e\nUses the Flux1 model for posterior density estimation on the two-moons benchmark.\n- `two_moons_diffusion_flux.ipynb` [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/aurelio-amerio/GenSBI-examples/blob/main/examples/sbi-benchmarks/two_moons/diffusion_flux/two_moons_diffusion_flux.ipynb) \u003cbr\u003e\nUses the Diffusion model for posterior density estimation on the two-moons benchmark.\n\n\u003e [!NOTE]\n\u003e A complete list of the currently available examples can be found at the [examples](https://aurelio-amerio.github.io/GenSBI/examples.html) documentation page.\n\n## Citing GenSBI\n\nIf you use this library, please consider citing this work and the original methodology papers, see [references](https://aurelio-amerio.github.io/GenSBI/references.html).\n\n```bibtex\n@misc{GenSBI,\n  author       = {Amerio, Aurelio},\n  title        = \"{GenSBI: Generative models for Simulation-Based Inference}\",\n  year         = {2026}, \n  publisher    = {GitHub},\n  journal      = {GitHub repository},\n  howpublished = {\\url{https://github.com/aurelio-amerio/GenSBI}}\n}\n```\n\n### Reference implementations\n\n- **Facebook Flow Matching library**: [https://github.com/facebookresearch/flow_matching](https://github.com/facebookresearch/flow_matching)\n- **Elucidating the Design Space of Diffusion-Based Generative Models**: [https://github.com/NVlabs/edm](https://github.com/NVlabs/edm)\n- **Simformer model**: [https://github.com/mackelab/simformer](https://github.com/mackelab/simformer)\n- **Flux1 model from BlackForest Lab**: [https://github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)\n- **Simulation-Based Inference Benchmark**: [https://github.com/sbi-benchmark/sbibm](https://github.com/sbi-benchmark/sbibm)\n\n\u003e [!NOTE]\n\u003e **AI Usage Disclosure** \u003cbr\u003e\n\u003e This project utilized large language models, specifically Google Gemini and GitHub Copilot, to assist with code suggestions, documentation drafting, and grammar corrections. All AI-generated content has been manually reviewed and verified by human authors to ensure accuracy and adherence to scientific standards.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faurelio-amerio%2Fgensbi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faurelio-amerio%2Fgensbi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faurelio-amerio%2Fgensbi/lists"}