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 requires Python 3.11 or newer.

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.5.0

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.5.0
File Size Uploaded Provenance Actions
glasflow-0.5.0.tar.gz 84.6 kB Without provenance Details for glasflow-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 161.9 kB

Release files / glasflow-0.5.0.tar.gz

Download URL glasflow-0.5.0.tar.gz
Size 84.6 kB
Tags Source
SHA-256 checksum
How to use checksums
64b6794bc2a481338d50b539ac01a2befd0785e3f7f30683a5e9a6584c26065d
BLAKE2b-256 checksum
How to use checksums
4414cfe910b14b9d74e78bb47a59ea1c91ee52bdfa854fb07e0f0d25b6b81b3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

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

Download URL glasflow-0.5.0-py3-none-any.whl
Size 77.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f60d6e54a51e407fb4d5dbc8b1676d080766fde41319ecfc3b6db1d1497fb2e7
BLAKE2b-256 checksum
How to use checksums
3e4ddad2fd2b787d6ffa93a762f11f74fe8a80b336e458d47d3dec1a72f2feb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for glasflow 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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