{"id":13395817,"url":"https://github.com/bayesiains/nflows","last_synced_at":"2025-03-13T22:31:04.589Z","repository":{"id":39967792,"uuid":"241103833","full_name":"bayesiains/nflows","owner":"bayesiains","description":"Normalizing flows in PyTorch","archived":false,"fork":false,"pushed_at":"2023-11-19T16:03:40.000Z","size":1434,"stargazers_count":801,"open_issues_count":12,"forks_count":120,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-04-25T23:03:11.038Z","etag":null,"topics":["density-estimation","generative-model","normalizing-flows","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bayesiains.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-02-17T12:36:32.000Z","updated_at":"2024-04-24T12:50:22.000Z","dependencies_parsed_at":"2023-11-19T17:24:26.404Z","dependency_job_id":"3f0698fb-2566-4686-8172-46193736c8a1","html_url":"https://github.com/bayesiains/nflows","commit_stats":{"total_commits":137,"total_committers":26,"mean_commits":5.269230769230769,"dds":0.7664233576642336,"last_synced_commit":"569c8ad50941824ccb07aa3a3eb59c85721e0c5f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesiains%2Fnflows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesiains%2Fnflows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesiains%2Fnflows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesiains%2Fnflows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bayesiains","download_url":"https://codeload.github.com/bayesiains/nflows/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221417202,"owners_count":16816831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","generative-model","normalizing-flows","pytorch"],"created_at":"2024-07-30T18:00:32.956Z","updated_at":"2025-03-13T22:31:04.583Z","avatar_url":"https://github.com/bayesiains.png","language":"Python","funding_links":[],"categories":["Python","📦 Packages \u003csmall\u003e(15)\u003c/small\u003e","📦 Packages"],"sub_categories":["\u003cimg src=\"assets/pytorch.svg\" alt=\"PyTorch\" height=\"20px\"\u003e \u0026nbsp;PyTorch Packages"],"readme":"# nflows\n\n\u003ca href=\"https://doi.org/10.5281/zenodo.4296287\"\u003e\u003cimg src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.4296287.svg\" alt=\"DOI\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/bayesiains/nflows/actions/workflows/build_lint_test.yml\"\u003e\u003cimg src=\"https://github.com/bayesiains/nflows/actions/workflows/build_lint_test.yml/badge.svg\" alt=\"Build status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/conda-forge/nflows-feedstock\"\u003e\u003cimg src=\"https://img.shields.io/conda/vn/conda-forge/nflows.svg\"\u003e\u003c/a\u003e\n\n`nflows` is a comprehensive collection of [normalizing flows](https://arxiv.org/abs/1912.02762) using [PyTorch](https://pytorch.org).\n\n## Installation\n\n### From PyPI\n\nTo install from PyPI:\n```\npython -m pip install nflows\n```\n\n### From conda-forge\n\nTo install and add `nflows` to a project with [`pixi`](https://pixi.sh/), from the project directory run\n\n```\npixi add nflows\n```\n\nand to install into a particular conda environment with [`conda`](https://docs.conda.io/projects/conda/), in the activated environment run\n\n```\nconda install --channel conda-forge nflows\n```\n\n## Usage\n\nTo define a flow:\n\n```python\nfrom nflows import transforms, distributions, flows\n\n# Define an invertible transformation.\ntransform = transforms.CompositeTransform([\n    transforms.MaskedAffineAutoregressiveTransform(features=2, hidden_features=4),\n    transforms.RandomPermutation(features=2)\n])\n\n# Define a base distribution.\nbase_distribution = distributions.StandardNormal(shape=[2])\n\n\n# Combine into a flow.\nflow = flows.Flow(transform=transform, distribution=base_distribution)\n```\n\nTo evaluate log probabilities of inputs:\n```python\nlog_prob = flow.log_prob(inputs)\n```\n\nTo sample from the flow:\n```python\nsamples = flow.sample(num_samples)\n```\n\nAdditional examples of the workflow are provided in [examples folder](examples/).\n\n## Development\n\nTo install all the dependencies for development:\n```\npip install -r requirements.txt\n```\n\n## Citing nflows\n\nTo cite the package:\n```bibtex\n@software{nflows,\n  author       = {Conor Durkan and\n                  Artur Bekasov and\n                  Iain Murray and\n                  George Papamakarios},\n  title        = {{nflows}: normalizing flows in {PyTorch}},\n  month        = nov,\n  year         = 2020,\n  publisher    = {Zenodo},\n  version      = {v0.14},\n  doi          = {10.5281/zenodo.4296287},\n  url          = {https://doi.org/10.5281/zenodo.4296287}\n}\n```\n\nThe version number is intended to be the one from `nflows/version.py`. The year/month correspond to the date of the release. BibTeX entries for other versions could be found on [Zenodo](https://doi.org/10.5281/zenodo.4296286).\n\nIf you're using spline-based flows in particular, consider citing the _Neural Spline Flows_ paper: [[bibtex]](https://papers.nips.cc/paper/2019/file/7ac71d433f282034e088473244df8c02-Bibtex.bib).\n\n## References\n`nflows` is derived from [bayesiains/nsf](https://github.com/bayesiains/nsf) originally published with\n\u003e C. Durkan, A. Bekasov, I. Murray, G. Papamakarios, _Neural Spline Flows_, NeurIPS 2019.\n\u003e [[arXiv]](https://arxiv.org/abs/1906.04032) [[bibtex]](https://papers.nips.cc/paper/2019/file/7ac71d433f282034e088473244df8c02-Bibtex.bib)\n\n\n`nflows` has been used in\n\u003e Conor Durkan, Iain Murray, George Papamakarios, _On Contrastive Learning for Likelihood-free Inference_, ICML 2020.\n\u003e [[arXiv]](https://arxiv.org/abs/2002.03712).\n\n\u003e Artur Bekasov, Iain Murray, _Ordering Dimensions with Nested Dropout Normalizing Flows_.\n\u003e [[arXiv]](https://arxiv.org/abs/2006.08777).\n\n\u003e Tim Dockhorn, James A. Ritchie, Yaoliang Yu, Iain Murray, _Density Deconvolution with Normalizing Flows_.\n\u003e [[arXiv]](https://arxiv.org/abs/2006.09396).\n\n`nflows` is used by the conditional density estimation package [pyknos](https://github.com/mackelab/pyknos), and in turn the likelihood-free inference framework [sbi](https://github.com/mackelab/sbi).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayesiains%2Fnflows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbayesiains%2Fnflows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayesiains%2Fnflows/lists"}