Skip to main content

DOI PyPI Conda Version

Glasflow

glasflow is a Python library containing a collection of Normalizing flows using PyTorch. It builds upon nflows.

Installation

glasflow is available to install via pip:

pip install glasflow

or via conda:

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:

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 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:

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.

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. 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. We also recommend you also cite nflows following the guidelines in the nflows readme.

Metadata

Release files for glasflow 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glasflow 0.4.1
File Size Uploaded
glasflow-0.4.1.tar.gz 64.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glasflow 0.4.1
File Interpreter ABI Platform
glasflow-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 140.8 kB

Release files / glasflow-0.4.1.tar.gz

Download URL glasflow-0.4.1.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e97eaf549743bc4ca6d05434f89ea93102f429f56322a490fca3888c44522c3d
BLAKE2b-256 checksum
How to use checksums
396d3b6c3468c2b1c306dc30d848652ef295e772a6f37d624573b726eca904d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / glasflow-0.4.1-py3-none-any.whl

Download URL glasflow-0.4.1-py3-none-any.whl
Size 76.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5579bcb53753e5f35f99398f82260947940bd5849565d64436164984158f5245
BLAKE2b-256 checksum
How to use checksums
098d11398cd06b2b2d8f7e5e34deff766bb8d93b869c88a29fb75a9c961d480a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page