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

Basic rewrite of the package 2023 edition Part I: ADVI #49

Merged
merged 213 commits into from
Dec 8, 2023

Conversation

Red-Portal
Copy link
Member

Hi, this is a partial pull request for #45.

The content of Part I is as follows:

Roadmap

  • Change the gradient computation interface such that different algorithms can directly manipulate the gradients.
  • Migrate to the LogDensityProblems interface.
  • Use the ADTypes interface.
  • Use Functor.jl for flattening/unflattening variational parameters.
  • Add more interfaces for calling optimize. (see Missing API method  #32 )
  • Migrate to Optimisers.jl.
  • Add callback option (Callback function during training #5)
  • Add control variate interface
  • Tests

Notes

  • The following pull request will include the general LocationScale variational family (Part II) and the documentation (Part III).
  • The current version uses the DistributionsAD.TuringDiagMvNormal variational family for running the tests.
  • Please refer to the original master pull request (Basic rewrite of the package 2023 edition #45) for the full set of discussions.

This is to avoid having to reconstruct transformed distributions all
the time. The direct use of bijectors also avoids going through lots
of abstraction layers that could break.

Instead, transformed distributions could be constructed only once when
returing the VI result.
- Full Monte Carlo ELBO estimation now works. I checked.
@yebai
Copy link
Member

yebai commented Nov 10, 2023

@torfjelde @Red-Portal This PR already looks good; let's try to get this PR merged in the next two weeks.

@Red-Portal
Copy link
Member Author

@torfjelde @yebai As discussed, I've removed the parts directly interacting with Bijectors. I think it's ready for another review pass. (Hopeful that we're close to being done for this PR!)

@yebai
Copy link
Member

yebai commented Dec 4, 2023

@torfjelde a reminder on this.

@torfjelde
Copy link
Member

Having a proper look now:)

Copy link
Member

@torfjelde torfjelde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few more comments, most of which should be quick accepts.

There's one one argument ordering of reparam_with_entropy that is potentially "discussable", but it should be a simple change if you accept it.

So. I think the time as come 👀

I am ready accept the PR 🙏

But this is really great work @Red-Portal 👏 And thank you so much for your persistence and just continuously chipping away ❤️ It must have been a pain, but I do think the PR is a much better state now than when we started, so it's been worth it:)

using ..ReverseDiff
end

# ReverseDiff without compiled tape
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not handle compiled tape?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into it.

ext/AdvancedVIBijectorsExt.jl Outdated Show resolved Hide resolved
ext/AdvancedVIBijectorsExt.jl Outdated Show resolved Hide resolved
src/objectives/elbo/entropy.jl Outdated Show resolved Hide resolved
src/objectives/elbo/entropy.jl Outdated Show resolved Hide resolved
src/objectives/elbo/repgradelbo.jl Outdated Show resolved Hide resolved
src/objectives/elbo/repgradelbo.jl Outdated Show resolved Hide resolved
src/objectives/elbo/repgradelbo.jl Outdated Show resolved Hide resolved
@Red-Portal Red-Portal merged commit 576259a into TuringLang:master Dec 8, 2023
8 checks passed
@yebai yebai mentioned this pull request Dec 22, 2023
13 tasks
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

Successfully merging this pull request may close these issues.

None yet

4 participants