Deep Learning for Bayesian Inference (dl4bi)
Install
Install with the appropriate command. If JAX isn't installed already, we recommend using one of the dl4bi[<jax-version>] installs.
pip install dl4bi # dl4bi
pip install dl4bi[cpu] # dl4bi + jax for CPU
pip install dl4bi[cuda12] # dl4bi + jax for CUDA-12
pip install dl4bi[cuda13] # dl4bi + jax for CUDA-13
pip install dl4bi[benchmarks,cpu] # benchmark deps + jax for CPU
pip install dl4bi[benchmarks,cuda12] # benchmark deps + jax for CUDA-12
pip install dl4bi[benchmarks,cuda13] # benchmark deps + jax for CUDA-13
The benchmarks extra installs the additional packages used by the benchmark scripts, especially under benchmarks/meta_learning and benchmarks/vae.
View Documentation (Locally)
git clone git@github.com:MLGlobalHealth/dl4bi.git
cd dl4bi
uv run --with pdoc pdoc --docformat google --math dl4bi
Cite
If you're using this package or some of its code, please cite the relevant paper(s):
@inproceedings{jenson2026scalable,
title = {Scalable Spatiotemporal Inference with Biased Scan Attention Transformer Neural Processes},
author = {Jenson, Daniel and Navott, Jhonathan and Grynfelder, Piotr and Zhang, Mengyan and Sharma, Makkunda and Semenova, Elizaveta and Flaxman, Seth},
booktitle = {Proceedings of the 29th International Conference on Artificial Intelligence and Statistics},
series = {Proceedings of Machine Learning Research},
volume = {300},
address = {Tangier, Morocco},
year = {2026},
publisher = {PMLR}
}
@inproceedings{navott2026deeprv,
title = {{DeepRV}: Accelerating Spatiotemporal Inference with Pre-trained Neural Priors},
author = {Navott, Jhonathan and Jenson, Daniel and Flaxman, Seth and Semenova, Elizaveta},
booktitle = {Proceedings of the 29th International Conference on Artificial Intelligence and Statistics},
series = {Proceedings of Machine Learning Research},
volume = {300},
address = {Tangier, Morocco},
year = {2026},
publisher = {PMLR}
}
Benchmarks are available for BSA-TNP here and for DeepRV here.
Development Setup
- Install
uv:curl -LsSf https://astral.sh/uv/install.sh | sh - Clone the repository and
cdinto it:git clone git@github.com:MLGlobalHealth/dl4bi.git && cd dl4bi - Install the latest Python with
uv:uv python install - Sync the project environment:
- CPU JAX:
uv sync --extra cpu - CUDA 12 JAX:
uv sync --extra cuda12 - CUDA 13 JAX:
uv sync --extra cuda13 - Benchmark deps + CPU JAX:
uv sync --extra benchmarks --extra cpu - Benchmark deps + CUDA 12 JAX:
uv sync --extra benchmarks --extra cuda12 - Benchmark deps + CUDA 13 JAX:
uv sync --extra benchmarks --extra cuda13
- CPU JAX:
uv synccreates.venv, installs the project in editable mode, includes the defaultdevdependency group, and picks a Python interpreter compatible with the project'srequires-python- Before making changes, install the shared development hooks:
uv run pre-commit install --install-hooks - Verify the hook setup once per clone with:
uv run pre-commit run --all-files - Keep the hooks installed for local development; commits on
mainrunpytest -q teststhrough the sharedpre-commitsetup - Run project commands through
uv, e.g.uv run pytestoruv run python gp.py - If you want to activate the virtualenv directly, use
source .venv/bin/activate
Build and Publish to PyPI
Create a local .env file with the publish tokens:
TEST_PYPI_TOKEN=pypi-...
PYPI_TOKEN=pypi-...
Run the release helper from a clean main checkout:
uv run python scripts/release.py .env "AISTATS 2026"
The helper bumps the patch version, commits and tags v<version> <message>,
rebuilds dist/, publishes to TestPyPI and PyPI, pushes main and the tag,
and smoke-tests the published install targets.
Metadata
Release files for dl4bi 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dl4bi-0.1.3.tar.gz | 30.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dl4bi-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.5 MB
Release files / dl4bi-0.1.3.tar.gz
| Download URL | dl4bi-0.1.3.tar.gz |
|---|---|
| Size | 30.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c155b5621fbde6372997da3e9dbdc3779787a6ef388c40c99875e771ddd47c54
|
|
BLAKE2b-256 checksum How to use checksums |
1f07121e5d37a14ffffa0c30fa5c9c7d5bd1f2368549d8fe65d633dd61393dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Void","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dl4bi-0.1.3-py3-none-any.whl
| Download URL | dl4bi-0.1.3-py3-none-any.whl |
|---|---|
| Size | 96.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51b39f5a543c0e319adf3b23065becf28adc6459c3b407102d93192ad2a845e3
|
|
BLAKE2b-256 checksum How to use checksums |
dda084d7e59336e43b52726b00c3fff8f6ac22e9af139e35d68bff343eef47d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Void","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|