Skip to main content

Transformer flows

Implementation of Apple ML's Transformer Flow (or TARFlow) from Normalising flows are capable generative models in jax and equinox.

Features:

  • jax.vmap & jax.lax.scan construction & forward-pass, for layers respectively for fast compilation and execution,
  • multi-device training, inference and sampling,
  • score-based denoising step (see paper),
  • conditioning via class embedding (for discrete class labels) or adaptive layer-normalisation (for continuous variables, like in DiT),
  • array-typed to-the-teeth for dependable execution with jaxtyping and beartype.

To implement:

  • Guidance
  • Denoising
  • Mixed precision
  • EMA
  • AdaLayerNorm
  • Class embedding
  • Hyperparameter/model saving
  • Uniform and Gaussian noise for dequantisation

Usage

pip install transformer-flows
uv run --all-extras python examples/main.py

Samples

I haven't optimised anything here (the authors mention varying the variance of noise used to dequantise the images), nor have I trained for very long. You can see slight artifacts due to the dequantisation noise.

Your image description

Your image description

Citation

@misc{zhai2024normalizingflowscapablegenerative,
      title={Normalizing Flows are Capable Generative Models}, 
      author={Shuangfei Zhai and Ruixiang Zhang and Preetum Nakkiran and David Berthelot and Jiatao Gu and Huangjie Zheng and Tianrong Chen and Miguel Angel Bautista and Navdeep Jaitly and Josh Susskind},
      year={2024},
      eprint={2412.06329},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2412.06329}, 
}

Metadata

Release files for transformer-flows 0.0.13

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

Source distribution (sdist)

Source distribution for transformer-flows 0.0.13
File Size Uploaded Provenance Actions
transformer_flows-0.0.13.tar.gz 15.4 MB Without provenance Details for transformer_flows-0.0.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for transformer-flows 0.0.13
File Interpreter ABI Platform Actions
transformer_flows-0.0.13-py3-none-any.whl Python 3 none any Details for transformer_flows-0.0.13-py3-none-any.whl

Total release size: 15.4 MB

Release files / transformer_flows-0.0.13.tar.gz

Download URL transformer_flows-0.0.13.tar.gz
Size 15.4 MB
Tags Source
SHA-256 checksum
How to use checksums
4646ee57838f8ee62d47abbe93e1587b9707d7d0558a17b9a680db9a44dbcc8f
BLAKE2b-256 checksum
How to use checksums
ef80ad67c51ce4d0304c8ac0bc1617f64efd96c34c2bed5e758f55634d2a9d86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.19

Release files / transformer_flows-0.0.13-py3-none-any.whl

Download URL transformer_flows-0.0.13-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
889918b51a065c952ab0f3b1bbbe9200ab8b37e65c74884ea66bc774867ccbf7
BLAKE2b-256 checksum
How to use checksums
6f7aad1fc6804b7979bd26997e20edfd96c5f574b7850afdc07e86f566d8ad3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.19

Security for transformer-flows 0.0.13

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