{"id":20240471,"url":"https://github.com/davidnabergoj/torchflows","last_synced_at":"2025-06-13T08:35:56.561Z","repository":{"id":199998707,"uuid":"640705550","full_name":"davidnabergoj/torchflows","owner":"davidnabergoj","description":"Modern normalizing flows in Python. Simple to use and easily extensible.","archived":false,"fork":false,"pushed_at":"2025-04-02T21:48:01.000Z","size":1051,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T22:29:17.920Z","etag":null,"topics":["density-estimation","generative-model","machine-learning","normalizing-flow","python","pytorch","sampling"],"latest_commit_sha":null,"homepage":"https://torchflows.readthedocs.io/en/latest/","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/davidnabergoj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2023-05-15T00:13:31.000Z","updated_at":"2025-03-05T06:20:39.000Z","dependencies_parsed_at":"2023-10-15T06:22:13.694Z","dependency_job_id":"6484d23c-907e-42b8-acfc-9452ee39721b","html_url":"https://github.com/davidnabergoj/torchflows","commit_stats":null,"previous_names":["davidnabergoj/normalizing-flows","davidnabergoj/torchflows"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnabergoj%2Ftorchflows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnabergoj%2Ftorchflows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnabergoj%2Ftorchflows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnabergoj%2Ftorchflows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidnabergoj","download_url":"https://codeload.github.com/davidnabergoj/torchflows/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248283382,"owners_count":21077834,"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","machine-learning","normalizing-flow","python","pytorch","sampling"],"created_at":"2024-11-14T08:46:39.242Z","updated_at":"2025-04-10T19:51:10.324Z","avatar_url":"https://github.com/davidnabergoj.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Torchflows: normalizing flows in PyTorch\n\nTorchflows is a library for generative modeling and density estimation using normalizing flows.\nIt implements many normalizing flow architectures and their building blocks for:\n\n* Easy use of normalizing flows as trainable distributions.\n* Easy implementation of new normalizing flows.\n\nExample use:\n\n```python\nimport torch\nfrom torchflows.flows import Flow\nfrom torchflows.architectures import RealNVP\n\ntorch.manual_seed(0)\n\nn_data = 1000\nn_dim = 3\n\nx = torch.randn(n_data, n_dim)  # Generate some training data\nbijection = RealNVP(n_dim)  # Create the bijection\nflow = Flow(bijection)  # Create the normalizing flow\n\nflow.fit(x)  # Fit the normalizing flow to training data\nlog_prob = flow.log_prob(x)  # Compute the log probability of training data\nx_new = flow.sample(50)  # Sample 50 new data points\n\nprint(log_prob.shape)  # (100,)\nprint(x_new.shape)  # (50, 3)\n```\n\nCheck out [examples](examples/) and the [documentation](https://torchflows.readthedocs.io/en/latest/), including the list of [supported architectures](https://torchflows.readthedocs.io/en/latest/).\n\n## Installing\n\nWe support Python versions 3.7 and upwards.\n\nInstall Torchflows via pip:\n\n```\npip install torchflows\n```\n\nInstall Torchflows directly from Github:\n\n```\npip install git+https://github.com/davidnabergoj/torchflows.git\n```\n\nSetup for development:\n\n```\ngit clone https://github.com/davidnabergoj/torchflows.git\ncd torchflows\npip install -r requirements.txt\n```\n\n## Citation\n\nIf you use this code in your work, we kindly ask that you cite the accompanying paper:\n\u003e [Nabergoj and Štrumbelj: Empirical evaluation of normalizing flows in Markov Chain Monte Carlo, 2024. arxiv:2412.17136.](https://arxiv.org/abs/2412.17136)\n\nBibTex entry:\n```\n@misc{nabergoj_nf_mcmc_evaluation_2024,\n    author = {Nabergoj, David and \\v{S}trumbelj, Erik},\n    title = {Empirical evaluation of normalizing flows in {Markov} {Chain} {Monte} {Carlo}},\n    publisher = {arXiv},\n    month = dec,\n    year = {2024},\n    note = {arxiv:2412.17136}\n}\n```\n\n## Contributions\n\nWe warmly welcome all contributions and comments. \nPlease do not hesitate to submit [issues](https://github.com/davidnabergoj/torchflows/issues) and [pull requests](https://github.com/davidnabergoj/torchflows/pulls).\n\nSome options to start contributing include:\n* Adding references to the documentation page for [architecture presets](https://torchflows.readthedocs.io/en/latest/architectures/index.html).\n* Implementing new normalizing flow architectures (see the [developer guide](https://torchflows.readthedocs.io/en/latest/developer_reference/index.html)).\n* Adding more [automated tests](./test) for numerical stability and optimization.\n* Adding docstrings to undocumented classes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidnabergoj%2Ftorchflows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidnabergoj%2Ftorchflows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidnabergoj%2Ftorchflows/lists"}