Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #24

Merged
merged 25 commits into from
Oct 19, 2024
Merged

Dev #24

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
286563a
Add convolutional continuous architectures
davidnabergoj Aug 31, 2024
d19939b
Add more Glow architectures
davidnabergoj Aug 31, 2024
898d3ca
Fix convolutional continuous NF shapes
davidnabergoj Aug 31, 2024
e68af96
Create Glow tests and convolutional continuous NF tests
davidnabergoj Aug 31, 2024
2e9a2ef
Simplify autoregressive architectures
davidnabergoj Aug 31, 2024
c5ad1b0
Fix UMNN MAF
davidnabergoj Aug 31, 2024
71a92ed
Add docstrings for class constructors
davidnabergoj Aug 31, 2024
42c5a06
Add docstrings
davidnabergoj Aug 31, 2024
028ce3e
Simplify autoregressive layer transformer kwargs
davidnabergoj Aug 31, 2024
1888a44
Major coupling NF cleanup/refactor
davidnabergoj Sep 1, 2024
bfdfbce
Masked/inverse autoregressive NF cleanup/refactor
davidnabergoj Sep 1, 2024
a510134
Elementwise bijection cleanup/refactor
davidnabergoj Sep 1, 2024
3bc85b0
Refactor classic residual bijections
davidnabergoj Sep 1, 2024
f3b22ca
Add convolutional residual flows and refactor residual event shapes
davidnabergoj Sep 1, 2024
b2c09c2
Add Glow architectures
davidnabergoj Sep 2, 2024
14007d7
Add architectures to __init__
davidnabergoj Sep 2, 2024
c5b681b
Remove unused imports
davidnabergoj Sep 2, 2024
283ab05
Add maximum batch size limit in megabytes for adaptive batch size; ad…
davidnabergoj Sep 3, 2024
d1f43a8
Set default max batch size in megabytes to None
davidnabergoj Sep 3, 2024
6232722
Add maximum training time option for NF training
davidnabergoj Sep 3, 2024
9094cdb
Fix residual flow fits
davidnabergoj Sep 4, 2024
fc5456b
Minor changes to continuous and residual NF parameter specification
davidnabergoj Sep 12, 2024
910adaf
Update docs
davidnabergoj Oct 19, 2024
5aefcd6
Update docstrings
davidnabergoj Oct 19, 2024
38d29e1
Fix typehint syntaxt
davidnabergoj Oct 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions docs/source/api/base_distributions.rst

This file was deleted.

24 changes: 0 additions & 24 deletions docs/source/api/bijections.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/api/components.rst

This file was deleted.

11 changes: 0 additions & 11 deletions docs/source/api/multiscale_architectures.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,38 +1,86 @@
Standard architectures
API for standard architectures
============================
We lists notable implemented bijection architectures.
These all inherit from the Bijection class.

.. _architectures:
.. _autoregressive_architecture_api:

Autoregressive architectures
--------------------------------

.. autoclass:: torchflows.architectures.RealNVP
:members: __init__

.. autoclass:: torchflows.architectures.InverseRealNVP
:members: __init__

.. autoclass:: torchflows.architectures.NICE
:members: __init__

.. autoclass:: torchflows.architectures.MAF
:members: __init__

.. autoclass:: torchflows.architectures.IAF
:members: __init__

.. autoclass:: torchflows.architectures.CouplingRQNSF
:members: __init__

.. autoclass:: torchflows.architectures.MaskedAutoregressiveRQNSF
:members: __init__

.. autoclass:: torchflows.architectures.InverseAutoregressiveRQNSF
:members: __init__

.. autoclass:: torchflows.architectures.CouplingLRS
:members: __init__

.. autoclass:: torchflows.architectures.MaskedAutoregressiveLRS
:members: __init__

.. autoclass:: torchflows.architectures.InverseAutoregressiveLRS
:members: __init__

.. autoclass:: torchflows.architectures.CouplingDSF
:members: __init__

.. autoclass:: torchflows.architectures.UMNNMAF
:members: __init__

.. _continuous_architecture_api:

Continuous architectures
-------------------------
.. autoclass:: torchflows.architectures.DeepDiffeomorphicBijection
:members: __init__

.. autoclass:: torchflows.architectures.RNODE
:members: __init__

.. autoclass:: torchflows.architectures.FFJORD
:members: __init__

.. autoclass:: torchflows.architectures.OTFlow
:members: __init__

.. _residual_architecture_api:

Residual architectures
-----------------------
.. autoclass:: torchflows.architectures.ResFlow
:members: __init__

.. autoclass:: torchflows.architectures.ProximalResFlow
:members: __init__

.. autoclass:: torchflows.architectures.InvertibleResNet
:members: __init__

.. autoclass:: torchflows.architectures.PlanarFlow
:members: __init__

.. autoclass:: torchflows.architectures.RadialFlow
.. autoclass:: torchflows.architectures.SylvesterFlow
:members: __init__

.. autoclass:: torchflows.architectures.SylvesterFlow
:members: __init__
56 changes: 56 additions & 0 deletions docs/source/architectures/image_modeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
API for multiscale architectures
========================================================

Multiscale architectures are suitable for image modeling.

.. _multiscale_architecture_api:


Classic multiscale architectures
------------------------------

.. autoclass:: torchflows.architectures.MultiscaleNICE
:members: __init__

.. autoclass:: torchflows.architectures.MultiscaleRealNVP
:members: __init__

.. autoclass:: torchflows.architectures.MultiscaleRQNSF
:members: __init__

.. autoclass:: torchflows.architectures.MultiscaleLRSNSF
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.MultiscaleDeepSigmoid
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.MultiscaleDenseSigmoid
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.MultiscaleDeepDenseSigmoid
:members: __init__


Glow-style multiscale architectures
------------------------------

.. autoclass:: torchflows.architectures.AffineGlow
:members: __init__

.. autoclass:: torchflows.architectures.ShiftGlow
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.RQSGlow
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.LRSGlow
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.DeepSigmoidGlow
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.DenseSigmoidGlow
:members: __init__

.. autoclass:: torchflows.bijections.finite.multiscale.architectures.DeepDenseSigmoidGlow
:members: __init__
187 changes: 187 additions & 0 deletions docs/source/architectures/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
Full list of architectures (presets)
=====================================================

We list all implemented NF architectures and their respective class names below.
Using these presets facilitates experimentation and modeling, however you can also modify each architecture and build new ones.

.. _autoregressive_architecture_list:

Autoregressive architectures
-----------------------------

We provide the list of autoregressive architectures in the table below.
Click the architecture name to see the API and usage examples.
Check the API for all autoregressive architectures :ref:`here <autoregressive_architecture_api>`.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`NICE <torchflows.bijections.finite.autoregressive.architectures.NICE>`
- Dinh et al. `NICE: Non-linear Independent Components Estimation <http://arxiv.org/abs/1410.8516>`_ (2015)
* - :class:`RealNVP <torchflows.bijections.finite.autoregressive.architectures.RealNVP>`
- Dinh et al. `Density estimation using Real NVP <http://arxiv.org/abs/1605.08803>`_ (2017)
* - :class:`Inverse RealNVP <torchflows.bijections.finite.autoregressive.architectures.InverseRealNVP>`
- Dinh et al. `Density estimation using Real NVP <http://arxiv.org/abs/1605.08803>`_ (2017)
* - :class:`MAF <torchflows.bijections.finite.autoregressive.architectures.MAF>`
- Papamakarios et al. `Masked Autoregressive Flow for Density Estimation <http://arxiv.org/abs/1705.07057>`_ (2018)
* - :class:`IAF <torchflows.bijections.finite.autoregressive.architectures.IAF>`
- Kingma et al. `Improving Variational Inference with Inverse Autoregressive Flow <http://arxiv.org/abs/1606.04934>`_ (2017)
* - :class:`Coupling RQ-NSF <torchflows.bijections.finite.autoregressive.architectures.CouplingRQNSF>`
- Durkan et al. `Neural Spline Flows <http://arxiv.org/abs/1906.04032>`_ (2019)
* - :class:`Masked autoregressive RQ-NSF <torchflows.bijections.finite.autoregressive.architectures.MaskedAutoregressiveRQNSF>`
- Durkan et al. `Neural Spline Flows <http://arxiv.org/abs/1906.04032>`_ (2019)
* - :class:`Inverse autoregressive RQ-NSF <torchflows.bijections.finite.autoregressive.architectures.InverseAutoregressiveRQNSF>`
- Durkan et al. `Neural Spline Flows <http://arxiv.org/abs/1906.04032>`_ (2019)
* - :class:`Coupling LR-NSF <torchflows.bijections.finite.autoregressive.architectures.CouplingLRS>`
- Dolatabadi et al. `Invertible Generative Modeling using Linear Rational Splines <http://arxiv.org/abs/2001.05168>`_ (2020)
* - :class:`Masked autoregressive LR-NSF <torchflows.bijections.finite.autoregressive.architectures.MaskedAutoregressiveLRS>`
- Dolatabadi et al. `Invertible Generative Modeling using Linear Rational Splines <http://arxiv.org/abs/2001.05168>`_ (2020)
* - :class:`Inverse autoregressive LR-NSF <torchflows.bijections.finite.autoregressive.architectures.InverseAutoregressiveLRS>`
- Dolatabadi et al. `Invertible Generative Modeling using Linear Rational Splines <http://arxiv.org/abs/2001.05168>`_ (2020)
* - :class:`Coupling deep SF <torchflows.bijections.finite.autoregressive.architectures.CouplingDeepSF>`
-
* - :class:`Masked autoregressive deep SF <torchflows.bijections.finite.autoregressive.architectures.MaskedAutoregressiveDeepSF>`
-
* - :class:`Inverse autoregressive deep SF <torchflows.bijections.finite.autoregressive.architectures.InverseAutoregressiveDeepSF>`
-
* - :class:`Coupling dense SF <torchflows.bijections.finite.autoregressive.architectures.CouplingDenseSF>`
-
* - :class:`Masked autoregressive dense SF <torchflows.bijections.finite.autoregressive.architectures.MaskedAutoregressiveDenseSF>`
-
* - :class:`Inverse autoregressive dense SF <torchflows.bijections.finite.autoregressive.architectures.InverseAutoregressiveDenseSF>`
-
* - :class:`Coupling deep-dense SF <torchflows.bijections.finite.autoregressive.architectures.CouplingDeepDenseSF>`
-
* - :class:`Masked autoregressive deep-dense SF <torchflows.bijections.finite.autoregressive.architectures.MaskedAutoregressiveDeepDenseSF>`
-
* - :class:`Inverse autoregressive deep-dense SF <torchflows.bijections.finite.autoregressive.architectures.InverseAutoregressiveDeepDenseSF>`
-
* - :class:`Unconstrained monotonic neural network <torchflows.bijections.finite.autoregressive.architectures.UMNNMAF>`
-

.. _multiscale_architecture_list:

Multiscale architectures
-----------------------------------------
We provide the list of multiscale autoregressive architectures in the table below.
These architectures are specifically made for image modeling, but can also be used for voxels or tensors with more dimensions.
Click the architecture name to see the API and usage examples.
Check the API for all multiscale architectures :ref:`here <multiscale_architecture_api>`.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`MultiscaleNICE <torchflows.bijections.finite.multiscale.architectures.MultiscaleNICE>`
- Dinh et al. `NICE: Non-linear Independent Components Estimation <http://arxiv.org/abs/1410.8516>`_ (2015)
* - :class:`Multiscale RealNVP <torchflows.bijections.finite.multiscale.architectures.MultiscaleRealNVP>`
- Dinh et al. `Density estimation using Real NVP <http://arxiv.org/abs/1605.08803>`_ (2017)
* - :class:`Multiscale RQ-NSF <torchflows.bijections.finite.multiscale.architectures.MultiscaleRQNSF>`
- Durkan et al. `Neural Spline Flows <http://arxiv.org/abs/1906.04032>`_ (2019)
* - :class:`Multiscale LR-NSF <torchflows.bijections.finite.multiscale.architectures.MultiscaleLRSNSF>`
- Dolatabadi et al. `Invertible Generative Modeling using Linear Rational Splines <http://arxiv.org/abs/2001.05168>`_ (2020)
* - :class:`Multiscale deep SF <torchflows.bijections.finite.multiscale.architectures.MultiscaleDeepSigmoid>`
-
* - :class:`Multiscale dense SF <torchflows.bijections.finite.multiscale.architectures.MultiscaleDenseSigmoid>`
-
* - :class:`Multiscale deep-dense SF <torchflows.bijections.finite.multiscale.architectures.MultiscaleDeepDenseSigmoid>`
-
* - :class:`Shift Glow <torchflows.bijections.finite.multiscale.architectures.ShiftGlow>`
-
* - :class:`Affine Glow <torchflows.bijections.finite.multiscale.architectures.AffineGlow>`
-
* - :class:`RQS Glow <torchflows.bijections.finite.multiscale.architectures.RQSGlow>`
-
* - :class:`LRS Glow <torchflows.bijections.finite.multiscale.architectures.LRSGlow>`
-
* - :class:`Deep sigmoidal Glow <torchflows.bijections.finite.multiscale.architectures.DeepSigmoidGlow>`
-
* - :class:`Dense sigmoidal Glow <torchflows.bijections.finite.multiscale.architectures.DenseSigmoidGlow>`
-
* - :class:`Deep-dense sigmoidal Glow <torchflows.bijections.finite.multiscale.architectures.DeepDenseSigmoidGlow>`
-

Residual architectures
----------------------------
We provide the list of iterative residual architectures in the table below.
Click the architecture name to see the API and usage examples.
Check the API for all residual architectures :ref:`here <residual_architecture_api>`.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`Invertible ResNet <torchflows.bijections.finite.residual.architectures.InvertibleResNet>`
-
* - :class:`ResFlow <torchflows.bijections.finite.residual.architectures.ResFlow>`
-
* - :class:`ProximalResFlow <torchflows.bijections.finite.residual.architectures.ProximalResFlow>`
-

We also list presets for some convolutional iterative residual architectures in the table below.
These are suitable for image modeling.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`Convolutional invertible ResNet <torchflows.bijections.finite.residual.architectures.ConvolutionalInvertibleResNet>`
-
* - :class:`Convolutional ResFlow <torchflows.bijections.finite.residual.architectures.ConvolutionalResFlow>`
-

We finally list presets for residual architectures, based on the matrix determinant lemma.
These support either forward or inverse transformation, but not both.
This means they can be used for either sampling (and variational inference) or density estimation (and maximum likelihood fits), but not both at the same time.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`Planar flow <torchflows.bijections.finite.residual.architectures.PlanarFlow>`
-
* - :class:`Radial flow <torchflows.bijections.finite.residual.architectures.RadialFlow>`
-
* - :class:`Sylvester flow <torchflows.bijections.finite.residual.architectures.SylvesterFlow>`
-

Continuous architectures
----------------------------
We provide the list of continuous architectures in the table below.
Click the architecture name to see the API and usage examples.
Check the API for all continuous architectures :ref:`here <continuous_architecture_api>`.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`DDNF <torchflows.bijections.finite.continuous.ddnf.DeepDiffeomorphicBijection>`
-
* - :class:`FFJORD <torchflows.bijections.finite.continuous.ffjord.FFJORD>`
-
* - :class:`RNODE <torchflows.bijections.finite.continuous.rnode.RNODE>`
-
* - :class:`OT-Flow <torchflows.bijections.finite.continuous.otflow.OTFlow>`
-

We also list presets for convolutional continuous architectures in the table below.
These are suitable for image modeling.

.. list-table::
:header-rows: 1

* - Architecture
- Reference
* - :class:`Convolutional DDNF <torchflows.bijections.finite.continuous.ddnf.ConvolutionalDeepDiffeomorphicBijection>`
-
* - :class:`Convolutional FFJORD <torchflows.bijections.finite.continuous.ffjord.ConvolutionalFFJORD>`
-
* - :class:`Convolutional RNODE <torchflows.bijections.finite.continuous.rnode.ConvolutionalRNODE>`
-
Loading
Loading