Skip to main content

Normalising flows using nflows

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glasflow-0.4.0.tar.gz (63.7 kB view details)

Uploaded Source

Built Distribution

glasflow-0.4.0-py3-none-any.whl (75.9 kB view details)

Uploaded Python 3

File details

Details for the file glasflow-0.4.0.tar.gz.

File metadata

  • Download URL: glasflow-0.4.0.tar.gz
  • Upload date:
  • Size: 63.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for glasflow-0.4.0.tar.gz
Algorithm Hash digest
SHA256 433f38c05a936b0f725586e501ed227f8e3928f25cd4dcaf98b3c6c652695250
MD5 10ce2094d61b02bfce998de4c9872d31
BLAKE2b-256 a8e9aca9d755928d88ed69ad450307e2583d8a7ea094ce0a3266af12674595f7

See more details on using hashes here.

File details

Details for the file glasflow-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: glasflow-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 75.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for glasflow-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e76047d6ebbeac569dd7a2aa6afd918787e36c421b1722e51af170d786ff07b5
MD5 52392d1eba71e5161eee7f8b39d857b3
BLAKE2b-256 4eae52df25b17eb61827cf1c67cec56fc08736262cc8f6a355403b4bba95ede6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page