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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend an external normalizing flow library #3297

Open
4 tasks
francois-rozet opened this issue Nov 24, 2023 · 3 comments
Open
4 tasks

Recommend an external normalizing flow library #3297

francois-rozet opened this issue Nov 24, 2023 · 3 comments

Comments

@francois-rozet
Copy link
Contributor

francois-rozet commented Nov 24, 2023

Hello 馃憢 As the development of Pyro's normalizing flow API has stopped for quite some time, I have been discussing with @fritzo about recommending an external normalizing flow library that would be compatible with Pyro.

I believe that Zuko would be a great recommendation, but disclaimer I am its maintainer.

Why Zuko?

I have extensively used and developed normalizing flows for my research and I always preferred the approach Pyro takes to define parametrized and conditional transformations over other libraries (nflows, FrEIA, FlowTorch, ...). In particular, I liked that Pyro's distributions/transformations shared the interface of PyTorch distributions/transformations, which is not the case of other libraries.

Hence, I started (2 years ago) coding my own normalizing flows for my research and at some point (1 year ago) decided to publish it as an open-source library: Zuko. The project has grown and now features many flow architectures (MAF, NSF, CNF, NAF, UMNN, GF, ...), automatic tests, a fully documented API and tutorials. The repository does not have as many stars as other libraries (mainly because I never advertised it), but actually has many users.

Most importantly, Zuko is very compatible with Pyro as it relies heavily on PyTorch's distributions interface. In Zuko, a flow is a distribution, with sample, log_prob, even_shape, etc.

Zuko is a reference to a powerful firebender (pyromancer) in the Avatar cartoon.

Roadmap

If the Pyro team agrees with recommending Zuko, I propose to

  • Update the current normalizing flow tutorial to mention that the flow API is not actively developed anymore.
  • Add a simple normalizing flow tutorial with Zuko. This would probably take inspiration from Zuko's tutorials.
  • Add a SVI tutorial with a normalizing flow guide.
  • Add a VAE tutorial with a normalizing flow prior.

WDYT?

@martinjankowiak
Copy link
Collaborator

i don't think we have any strong preferences about any particular normalizing flow library: the more the merrier (provided they're well designed and more-or-less maintained). the issue with all open source contribution is that it's generally easier to add code than it is to maintain it over a long period of time. for example, afaik flowtorch isn't being very actively maintained, and indeed as the tutorial title "Normalizing Flows - Introduction (Part 1)" indicates, a second tutorial was planned but was not forthcoming.

your plan sounds reasonable to me but i'd probably instead rename the above-mentioned tutorial to something like "Normalizing Flows with FlowTorch" and then add a second tutorial named something like "Normalizing Flows with Zuko". i don't see any particular reason to have an exclusive allegiance to one normalizing flows library

@francois-rozet
Copy link
Contributor Author

francois-rozet commented Dec 1, 2023

Hello @martinjankowiak, thank you for your answer. If I am not mistaken, the current tutorial does not mention FlowTorch and does not make use of its components. It only uses the built-in components of Pyro. It is still a great introduction to Normalizing Flows though, so I think renaming it "Normalizing Flows - Introduction", or "Normalizing Flows - The basics", would fit well.

I agree that the more libraries, the better, but since the built-in flow API is not developed anymore, I think recommending a few compatible alternatives would be nice.

@francois-rozet
Copy link
Contributor Author

francois-rozet commented Dec 5, 2023

Hello @fritzo, @martinjankowiak, I have submitted a PR (#3302) which adds two tutorials (SVI and VAE) using normalizing flows. The PR also updates the current normalizing flow tutorial. WDYT?

By the way, I tried to write a tutorial about Zuko itself, but I ended up with a copy-paste of the learning the basics tutorial of Zuko, which felt out-of-place within the Pyro tutorials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants