-
Notifications
You must be signed in to change notification settings - Fork 35
Remove initialstep
, rework default_varinfo
#938
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
Draft
penelopeysm
wants to merge
4
commits into
main
Choose a base branch
from
py/no-initialstep
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmark Report for Commit ef6522fComputer Information
Benchmark Results
|
This is going to be messy.... |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #938 +/- ##
===========================================
- Coverage 82.91% 34.11% -48.80%
===========================================
Files 36 36
Lines 3962 3928 -34
===========================================
- Hits 3285 1340 -1945
- Misses 677 2588 +1911 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pull Request Test Coverage Report for Build 15240990436Details
💛 - Coveralls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Other changes in service of TuringLang/Turing.jl#2555 --- but I think these also make life easier.
The point was that
AbstractMCMC.step(rng, ::Model, ::DynamicPPL.Sampler)
would do a few things:default_varinfo
for the model (which meant typed varinfo, unless you specifically overrode it)DynamicPPL.initialstep(...)
with that new varinfoBecause I'm now changing
sample
andstep
to work withLogDensityFunction
s rather thanModel
, this means that the work to create the varinfo has to be done before callingstep
. See:https://github.com/TuringLang/Turing.jl/blob/9054b0af3f6cd625c1e981b7b96c800ade63ca3f/src/mcmc/sample.jl#L186-L200
So, this PR:
default_varinfo
, and adds an argument to link the varinfo (which Turing samplers can then make use of, by declaring that they need unconstrained space)default_varinfo
is called higher up, it no longer needs to be part ofAbstractMCMC.step
, and thusinitialstep
is no longer necessary.Samplers that implemented
DynamicPPL.initialstep(rng, model, spl, vi, ...)
should just implementAbstractMCMC.step(rng, ldf, spl)
in exactly the same way.Note that all of these are merely interface changes -- they don't actually affect any code in DynamicPPL as none of the actual sampling is implemented here.
I'm not sure if this should be a breaking change. Technically, none of these functions were exported, so I have erred on the side of danger and marked it as a patch.