{"id":16518982,"url":"https://github.com/fabricioarendtorres/flowconductor","last_synced_at":"2025-10-08T17:13:37.976Z","repository":{"id":203334259,"uuid":"662701492","full_name":"FabricioArendTorres/FlowConductor","owner":"FabricioArendTorres","description":"(Conditional) Normalizing Flows in PyTorch. Offers a wide range of (conditional) invertible neural networks.","archived":false,"fork":false,"pushed_at":"2024-11-28T14:30:55.000Z","size":2090,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-23T07:55:27.113Z","etag":null,"topics":["bijective-maps","flow","neural-network","normalizing","normalizing-flow","python","pytorch"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flowcon/","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/FabricioArendTorres.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-05T17:42:31.000Z","updated_at":"2025-06-29T14:21:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"c02c1503-037e-4689-9cc3-92db623d9c49","html_url":"https://github.com/FabricioArendTorres/FlowConductor","commit_stats":null,"previous_names":["fabricioarendtorres/enflows"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/FabricioArendTorres/FlowConductor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabricioArendTorres%2FFlowConductor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabricioArendTorres%2FFlowConductor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabricioArendTorres%2FFlowConductor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabricioArendTorres%2FFlowConductor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FabricioArendTorres","download_url":"https://codeload.github.com/FabricioArendTorres/FlowConductor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabricioArendTorres%2FFlowConductor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278981518,"owners_count":26079640,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bijective-maps","flow","neural-network","normalizing","normalizing-flow","python","pytorch"],"created_at":"2024-10-11T16:44:34.287Z","updated_at":"2025-10-08T17:13:37.913Z","avatar_url":"https://github.com/FabricioArendTorres.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FlowConductor: (Conditional) Normalizing Flows and \u003c/br\u003e bijective Layers for Pytorch\n\n\u003ca href=\"https://github.com/FabricioArendTorres/enflows/actions/workflows/build_lint_test.yml\"\u003e\u003cimg src=\"https://github.com/FabricioArendTorres/FlowConductor/actions/workflows/build_lint_test.yml/badge.svg\" alt=\"Build status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/FabricioArendTorres/FlowConductor\" \u003e\n\u003cimg src=\"https://codecov.io/gh/FabricioArendTorres/FlowConductor/graph/badge.svg?token=UPQ2ZNQ6G4\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://fabricioarendtorres.github.io/FlowConductor/\"\u003e\u003cimg src=\"https://github.com/FabricioArendTorres/FlowConductor/actions/workflows/build_and_deploy_documentation.yml/badge.svg\" alt=\"Documentation\"\u003e\u003c/a\u003e\n[![DOI](https://zenodo.org/badge/662701492.svg)](https://doi.org/10.5281/zenodo.13952361)\n\n\u003ca href=\"https://fabricioarendtorres.github.io/FlowConductor/\"\u003e\u003ch3\u003eDocumentation\u003c/h3\u003e \u003c/a\u003e\n-----\n## About\nFlowConductor provides a collection of [normalizing flows](https://arxiv.org/abs/1912.02762) in  [PyTorch](https://pytorch.org).\nIt's core logic and transformations were originally based on the [nflows package](https://github.com/bayesiains/nflows).\nThe main focus lies in implementing more flow layers from the literature in one consistent framework, and adding support for conditional normalizing flows.\nIn the original nflows package, conditional networks were restricted to using a conditional base distribution. \nIn `FlowConductor`, nearly every layer can be conditional :).\nIn particular, we support conditional transformations based on hypernetworks.\n\n\nWhile using the package, we extensively expanded it, implementing layers such as invertible residual networks, and focusing on conditional normalizing flows.\nIn addition, we improved the testing, so that the Jacobian determinants are actually reliably compared to a reference based on brute-force autograd.\n\nThe bijective layers we additionally provide includes but are not limited to Planar Flows, (conditional) invertible ResNets/DenseNets, a variant of neural autoregressive flows, and a basic support of continuous normalizing flows (and FFJORD) based on the `torchdiffeq` package.\n\n\n## Install\n### PIP\nFlowConductor is installable via `pip`.\nWe recommend using a virtual environment, where you set up your pytorch version beforehand.\nYou can check out in `./docker` which pytorch versions we test for, but in general there shouldn't be any complications\nfor any version after 1.13.\n\nYou may either install the latest release from pipy:\n```\n$  pip install flowcon\n```\n\nor install it directly from github via pip \n```\n$  pip install git+https://github.com/FabricioArendTorres/FlowConductor.git\n```\n\nOf course, you may also just download the repo and install it locally\n```\n$ git clone https://github.com/FabricioArendTorres/FlowConductor\n$ cd FlowConductor\n$ pip install . \n```\n\n\n### Docker\nWe provide some basic Dockerfiles in `./docker`, which are very simple extensions of the pytorch docker images.\nThe dockerfiles we list are the ones used for testing, so you can be sure they work.\nIf you are unfamiliar with Docker, you can use our package with it as follows (assuming it is at least installed).\n\nThis also works on Windows (cpu at least)!\n\n```\n$ git clone https://github.com/FabricioArendTorres/FlowConductor\n$ cd FlowConductor\n\n# Build the docker image, see the ./docker dir for different versions.\n$ docker build -f ./docker/Dockerfile-pytorchlatest -t flowc-pytorchlatest .\n\n# you can run the tests with\ndocker run flowc-pytorchlatest pytest /flowc\n```\n\nFor working with this container, you may either choose to adapt our Dockerfiles, \nor simply bind the current directory when starting the container interactively.\nFor the latter, you can run a script (here `examples/toy_2d.py`) with\n\n```$ docker run --rm -it -v .:/app flowc-pytorchlatest python examples/toy_2d.py```\nOr you may swap an interactive shell within the container with\n```\n$ docker run --rm -it -v .:/app flowc-pytorchlatest\n$ python examples/toy_2d.py\n```\n\n## Package Usage\n\nAs the core is based on `nflows`, its usage is similar. To define a flow:\n\n```python\nfrom flowcon 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# 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# Changes and added features compared to nflows\nThe core logic of the code for LFlows (i.e. the `nflows/` directory) is based on the [nflows package](https://github.com/bayesiains/nflows).\nAside from added features, our extension provides tests for the calculation of the Jacobian log-determinant, which is at the heart of Normalizing Flow.\n\nAdded Layers / Flwos:\n\n- [(Conditional) Sum-of-Sigmoid Layers](https://arxiv.org/abs/2306.07255)\n- [Cholesky Outer Product for flows on symmetric positive definite matrices](https://arxiv.org/abs/2306.07255)\n- [Lipschitz Constrained invertible DenseNets](https://arxiv.org/abs/2010.02125)\n  In particular, we provide three ways to condition these of these transformations without affecting the invertibility.\n- Transformations for which the inverse is only known to exist, but not available: \n  - [(Conditional) Planar Flow](https://arxiv.org/abs/1912.02762) \n  - [(Conditional) Sylvester Flow](https://arxiv.org/abs/1803.05649)\n- Conditional Versions of existing non-conditional transformations from nflows. Can be found for imports at `nflows.transforms.conditional.*`:\n    - LU Transform\n    - Orthogonal Transforms based on parameterized Householder projections\n    - SVD based on the Orthogonal transforms\n    - Shift Transform\n- Conditional Versions of existing auto-regressive Variations, i.e. getting rid of the autoregressive parts.\n    - [ConditionalPiecewiseRationalQuadraticTransform](https://proceedings.neurips.cc/paper/2019/hash/7ac71d433f282034e088473244df8c02-Abstract.html)\n    - [ConditionalUMNNTransform](https://arxiv.org/abs/1908.05164)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabricioarendtorres%2Fflowconductor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabricioarendtorres%2Fflowconductor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabricioarendtorres%2Fflowconductor/lists"}