[](https://doi.org/10.5281/zenodo.7108558)
[](https://pypi.org/project/glasflow/)
[](https://anaconda.org/conda-forge/glasflow)
# Glasflow
glasflow is a Python library containing a collection of [Normalizing flows](https://arxiv.org/abs/1912.02762) using [PyTorch](https://pytorch.org). It builds upon [nflows](https://github.com/bayesiains/nflows).
## Installation
glasflow is available to install via `pip`:
```shell
pip install glasflow
```
or via `conda`:
```shell
conda install glasflow -c conda-forge
```
## PyTorch
**Important:** `glasflow` supports using CUDA devices but it is not a requirement and in most uses cases it provides little to no benefit.
By default the version of PyTorch installed by `pip` or `conda` will not necessarily match the drivers on your system, to install a different version with the correct CUDA support see the PyTorch homepage for instructions: <https://pytorch.org/>.
## Usage
To define a RealNVP flow:
```python
from glasflow import RealNVP
# define RealNVP flow. Change hyperparameters as necessary.
flow = RealNVP(
n_inputs=2,
n_transforms=5,
n_neurons=32,
batch_norm_between_transforms=True
)
```
Please see [glasflow/examples](https://github.com/uofgravity/glasflow/tree/main/examples) for a typical training regime example.
## nflows
glasflow uses a fork of nflows which is included as submodule in glasflow and can used imported as follows:
```python
import glasflow.nflows as nflows
```
It contains various bugfixes which, as of writing this, are not included in a current release of `nflows`.
### Using standard nflows
There is also the option to use an independent install of nflows (if installed) by setting an environment variable.
```shell
export GLASFLOW_USE_NFLOWS=True
```
After setting this variable `glasflow.nflows` will point to the version of nflows installed in the current python environment.
**Note:** this must be set prior to importing glasflow.
## Contributing
Pull requests are welcome. You can review the contribution guidelines [here](https://github.com/uofgravity/glasflow/blob/main/CONTRIBUTING.md). For major changes, please open an issue first to discuss what you would like to change.
## Citing
If you use glasflow in your work please cite [our DOI](https://doi.org/10.5281/zenodo.7108558). We also recommend you also cite nflows following the guidelines in the [nflows readme](https://github.com/uofgravity/nflows#citing-nflows).
Raw data
{
"_id": null,
"home_page": null,
"name": "glasflow",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "normalising flows, normalizing flows, machine learning",
"author": "Jordan McGinn",
"author_email": "\"Michael J. Williams\" <michaeljw1@googlemail.com>, Federico Stachurski <f.stachurski.1@research.gla.ac.uk>, John Veitch <john.veitch@glasgow.ac.uk>",
"download_url": "https://files.pythonhosted.org/packages/39/6d/3b6c3468c2b1c306dc30d848652ef295e772a6f37d624573b726eca904d7/glasflow-0.4.1.tar.gz",
"platform": null,
"description": "[](https://doi.org/10.5281/zenodo.7108558)\n[](https://pypi.org/project/glasflow/)\n[](https://anaconda.org/conda-forge/glasflow)\n\n# Glasflow\n\nglasflow is a Python library containing a collection of [Normalizing flows](https://arxiv.org/abs/1912.02762) using [PyTorch](https://pytorch.org). It builds upon [nflows](https://github.com/bayesiains/nflows).\n\n## Installation\n\nglasflow is available to install via `pip`:\n\n```shell\npip install glasflow\n```\n\nor via `conda`:\n\n```shell\nconda install glasflow -c conda-forge\n```\n\n## PyTorch\n\n**Important:** `glasflow` supports using CUDA devices but it is not a requirement and in most uses cases it provides little to no benefit.\n\nBy default the version of PyTorch installed by `pip` or `conda` will not necessarily match the drivers on your system, to install a different version with the correct CUDA support see the PyTorch homepage for instructions: <https://pytorch.org/>.\n\n## Usage\n\nTo define a RealNVP flow:\n\n```python\nfrom glasflow import RealNVP\n\n# define RealNVP flow. Change hyperparameters as necessary.\nflow = RealNVP(\n n_inputs=2,\n n_transforms=5,\n n_neurons=32,\n batch_norm_between_transforms=True\n)\n```\n\nPlease see [glasflow/examples](https://github.com/uofgravity/glasflow/tree/main/examples) for a typical training regime example.\n\n## nflows\n\nglasflow uses a fork of nflows which is included as submodule in glasflow and can used imported as follows:\n\n```python\nimport glasflow.nflows as nflows\n```\n\nIt contains various bugfixes which, as of writing this, are not included in a current release of `nflows`.\n\n### Using standard nflows\n\nThere is also the option to use an independent install of nflows (if installed) by setting an environment variable.\n\n```shell\nexport GLASFLOW_USE_NFLOWS=True\n```\n\nAfter setting this variable `glasflow.nflows` will point to the version of nflows installed in the current python environment.\n\n**Note:** this must be set prior to importing glasflow.\n\n## Contributing\n\nPull requests are welcome. You can review the contribution guidelines [here](https://github.com/uofgravity/glasflow/blob/main/CONTRIBUTING.md). For major changes, please open an issue first to discuss what you would like to change.\n\n## Citing\n\nIf you use glasflow in your work please cite [our DOI](https://doi.org/10.5281/zenodo.7108558). We also recommend you also cite nflows following the guidelines in the [nflows readme](https://github.com/uofgravity/nflows#citing-nflows).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Normalising flows using nflows",
"version": "0.4.1",
"project_urls": {
"Homepage": "https://github.com/uofgravity/glasflow"
},
"split_keywords": [
"normalising flows",
" normalizing flows",
" machine learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "098d11398cd06b2b2d8f7e5e34deff766bb8d93b869c88a29fb75a9c961d480a",
"md5": "963e2fb1655cd0ce7338a952e13057c2",
"sha256": "5579bcb53753e5f35f99398f82260947940bd5849565d64436164984158f5245"
},
"downloads": -1,
"filename": "glasflow-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "963e2fb1655cd0ce7338a952e13057c2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 76605,
"upload_time": "2024-10-10T16:55:44",
"upload_time_iso_8601": "2024-10-10T16:55:44.539250Z",
"url": "https://files.pythonhosted.org/packages/09/8d/11398cd06b2b2d8f7e5e34deff766bb8d93b869c88a29fb75a9c961d480a/glasflow-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "396d3b6c3468c2b1c306dc30d848652ef295e772a6f37d624573b726eca904d7",
"md5": "3a8fb50875037c534ea947867220db2e",
"sha256": "e97eaf549743bc4ca6d05434f89ea93102f429f56322a490fca3888c44522c3d"
},
"downloads": -1,
"filename": "glasflow-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "3a8fb50875037c534ea947867220db2e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 64176,
"upload_time": "2024-10-10T16:55:45",
"upload_time_iso_8601": "2024-10-10T16:55:45.930634Z",
"url": "https://files.pythonhosted.org/packages/39/6d/3b6c3468c2b1c306dc30d848652ef295e772a6f37d624573b726eca904d7/glasflow-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 16:55:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "uofgravity",
"github_project": "glasflow",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "glasflow"
}