← all repositories
VincentStimper/normalizing-flows

A toolbox for turning simple distributions into weird ones

PyTorch library that implements ten normalizing flow architectures so you don't have to.

952 stars Python Other AI
normalizing-flows
Velocity · 7d
+0.4
★ / day
Trend
steady
star history

What it does

normflows is a PyTorch package for discrete normalizing flows — the technique of stacking invertible transformations to warp a simple base distribution (usually a Gaussian) into a complex target distribution. It bundles ten architectures including Real NVP, Glow, Neural Spline Flow, and Residual Flow, plus base distributions, target distributions, and training objectives like forward and reverse KL divergence.

The interesting bit

The library doesn’t just reimplement papers; it handles the fiddly bits you forget about, like zero-initializing the last layer of coupling-networks for stable training, and swapping dimensions automatically between affine coupling blocks. It also supports circular coordinates for Neural Spline Flows — useful when your data lives on a cylinder or torus rather than flat space.

Key highlights

  • Ten flow architectures in one API, from 2015 (Planar/Radial) through 2020 (Stochastic Normalizing Flows)
  • Ready-to-run Colab notebooks for Real NVP, Neural Spline Flow, and Glow on CIFAR-10
  • Published in JOSS with full documentation and unit tests
  • Installable via pip install normflows; requires Python ≥3.7
  • Modular design: mix base distributions, flow layers, and neural network parameter maps

Caveats

  • The README notes an architectural limitation of normalizing flows (density filaments connecting disconnected modes) that is “especially prominent in Real NVP” — not a bug, but a fundamental constraint users should know about
  • GPU setup is left to the user to configure PyTorch correctly

Verdict

Researchers and practitioners who need to compare flow architectures or prototype density estimation models will save hours. If you’re already committed to a single custom flow implementation and don’t need the breadth, it’s probably overkill.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.