-
Notifications
You must be signed in to change notification settings - Fork 219
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
Fixed externalsampler
#2089
Fixed externalsampler
#2089
Conversation
Pull Request Test Coverage Report for Build 6454918003
💛 - Coveralls |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2089 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 21 21
Lines 1451 1451
======================================
Misses 1451 1451
☔ View full report in Codecov by Sentry. |
According to codecov, both the old and new implementation is not covered. Related to external samplers, Turing.jl/src/mcmc/Inference.jl Line 107 in ed410b1
const ESLogDensityFunction{M<:Model,S<:Sampler{<:ExternalSampler},V<:AbstractVarInfo} = Turing.LogDensityFunction{V,M,<:DynamicPPL.SamplingContext{<:S}} |
This is quite strange though, as Line 79 in 3780ca8
|
This reverts commit 3780ca8.
I applied your suggestion a bit too quickly here:) No, the original impl was correct.
|
I see. The line still seems wrong to me - since the (external) sampler is not used on the RHS, it means that anything defined for |
Ah great point and 100% agree 👍 Turing.jl/src/mcmc/Inference.jl Lines 108 to 116 in f8876d6
which is an unfortunate hack we need to be compatible with AdvancedMH.jl IIRC. But yeah, we should def just remove |
function LogDensityProblems.logdensity( | ||
f::Turing.LogDensityFunction{<:AbstractVarInfo,<:Model,<:DynamicPPL.DefaultContext}, | ||
x::NamedTuple | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is type piracy (I know it was already there 😉 - and BTW DynamicPPL.unflatten
below is another instance of type piracy). In DynamicPPL, we explicitly decided to not add this overload: TuringLang/DynamicPPL.jl#501 Can we just remove it completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeaaah I'm aware of both and I don't like them 😕
It's done to be compatible with AdvancedMH.jl which allows you to specify the proposal distribution using NamedTuple
😕 So we can't just remove it without messing with this; we'd have to do some more work for that, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you go to that PR, you can see that it was closed it in favour of another commit that did basically the same thing 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh haha I missed that, I just remembered that the issue had been closed 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You okay with this leaving this for now @devmotion ? This PR is meant to fix existing code, so feel like maybe we should get this merged and maybe make an issue / separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's address this separately.
How can I help to get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
We recently made some improvements to the construction of the chains (#2071), and in the process seem to have broken the
externalsampler
(though I'm somewhat confused as to how tests were passing).