-
Notifications
You must be signed in to change notification settings - Fork 32
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
Remove dot_tilde pipeline #804
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release-0.35 #804 +/- ##
================================================
- Coverage 86.32% 84.43% -1.90%
================================================
Files 35 34 -1
Lines 4162 3823 -339
================================================
- Hits 3593 3228 -365
- Misses 569 595 +26 ☔ View full report in Codecov by Sentry. |
Pull Request Test Coverage Report for Build 13377908373Details
💛 - Coveralls |
@@ -139,8 +139,6 @@ | |||
|
|||
@testset "SimpleVarInfo on $(nameof(model))" for model in | |||
DynamicPPL.TestUtils.DEMO_MODELS | |||
model = DynamicPPL.TestUtils.demo_dot_assume_matrix_dot_observe_matrix() |
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.
Note that this line was making us always test one single model, even though we were ostensibly in a loop over models. Presumably this got committed by accident at some point.
# TODO(mhauru) Fix linked SimpleVarInfos to work with our test models. | ||
# DynamicPPL.settrans!!(deepcopy(svi_nt), true), | ||
# DynamicPPL.settrans!!(deepcopy(svi_dict), true), | ||
# DynamicPPL.settrans!!(deepcopy(svi_vnv), true), |
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 remove the line a bit above, that was fixing the model, it turns out that even on master many of the models fail with linked SimpleVarInfos. Some passed, I'm not sure what it was that made the difference. Presumably some quirk of SimpleVarInfo interacted badly with some types of models.
With the new implementation of .~
all of the test models fail with linked SimpleVarInfos. I assume its the same problem as before, but now manifesting itself in all test models, due to changes in the test models. Hence commenting out these three. I wouldn't really call this a regression in tests, in that these only ever passed for a few select models, whereas now at least we check the unlinked SimpleVarInfos for all models.
One single test in |
Will leave approval to someone who is more hands on, but really like this:) One thing: seems like this would warrant a bump of the minor version given it's breaking? |
Thanks @torfjelde!
The PR is proposed to be merged to the |
The remaining test failures are Mooncake issues. Not sure what to do about them (mark as broken?), but it does make this ready for review. |
@willtebbutt confirms that the Mooncake test failures are an instance of compintell/Mooncake.jl#319, which in turn is caused by a Julia compiler bug. |
I'm happy to approve on the code changes, but I'm hesitant to click on the button because I'm still very curious about the Mooncake errors. I managed to get a simple model with a literal on the LHS to error (see compintell/Mooncake.jl#484 for context) and I'm extremely confused by why it happens only with one model and not the others, and only in some cases but not. I'd like to understand, from the DynamicPPL point of view, what it is in that one model that gives it problems. |
I'm also aware that could be a huge time sink, and could easily be one day of good work. |
FWIW, I would only say that it's a good use of time to get to the bottom of why one DynamicPPL model triggers this only if you're keen to practice your compiler-debugging skills. I'm hoping to have a patch sorted by the end of the day, so if you're happy to hold off on pressing the button for a few hours, it should go away anyway. |
Rewriting @model function f() # errors!
s ~ InverseGamma(2, 3)
m ~ Normal(0, sqrt(s))
[1.5, 2.0] .~ Normal(m, sqrt(s))
end into @model function f() # fine!
s ~ InverseGamma(2, 3)
m ~ Normal(0, sqrt(s))
[1.5, 2.0][(1,)...] ~ Normal(m, sqrt(s))
[1.5, 2.0][(2,)...] ~ Normal(m, sqrt(s))
end avoids the Mooncake error. In fact, even @model function f() # also fine!
s ~ InverseGamma(2, 3)
m ~ Normal(0, sqrt(s))
x = [1.5, 2.0]
for idx in Iterators.product(axes(x)...)
x[idx...] ~ Normal(m, sqrt(s))
end
end is perfectly fine. I don't know why the current implementation of .~ is problematic, but I wonder if there is a workaround that will let us circumvent the Mooncake issue.
This was an error on my part, see compintell/Mooncake.jl#484 (comment) for context. |
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.
I concede defeat
Maybe mark the tests as broken, but that's about it |
Over in compintell/Mooncake.jl#319 @willtebbutt said he wanted to see if he could put in a quick workaround, so I'll wait to hear from him first, but I'm happy to mark as broken if need be. |
Oh, okay, we can wait then! |
Just to double check I'm interpreting CI results correctly: am I right in saying that compintell/Mooncake.jl#319 is only causing this PR problems on Julia 1.11, not 1.10? (This would make sense, as the offending code only appears to appear in the compiler in 1.11.) |
Yup, so it seems. |
Fab. I'm just waiting for CI to pass in compintell/Mooncake.jl#487 , then I'll make a release which should fix the problem. |
v0.4.90 ought to solve the problem :) |
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.
Sorry, I didn't mean to rescind my original approval with that change above. Happy to merge!
This PR reimplements
.~
so that it is turned into a loop over~
statements at macro time. It also restricts the RHS of.~
to be a univariate distribution. This breaks code where either an array of distributions or a multivariate distribution was used on the RHS. The former case can easily be worked around by rather using~ product_distribution(...)
(and performance is in many cases improved by it), the latter case is presumably rare and can be worked around by using a loop.All the real changes are in
compiler.jl
and the tests. Everything else is just deleting code that is no longer needed after this change.