-
Notifications
You must be signed in to change notification settings - Fork 228
Improve error message for initialization failures with troubleshootin… #2637
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
Changes from 1 commit
67efd02
9c33116
85c7f74
fa97490
a0fe160
a178d70
7bc16b8
fe8409c
8512827
f2925d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,6 +276,29 @@ using Turing | |
@test Turing.Inference.getstepsize(spl, hmc_state) isa Float64 | ||
end | ||
end | ||
|
||
@testset "improved error message for initialization failures" begin | ||
# Model that fails to initialize due to VonMises AD issue | ||
@model function failing_model() | ||
μ ~ Uniform(-π, π) | ||
κ ~ InverseGamma(2, 3) | ||
return x ~ VonMises(μ, κ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This model might get fixed at some point, independently of us (the issue is in AD packages/Distributions.jl). Would something like any super simple model but with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line 208 through 215 already contains the same test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with |
||
end | ||
|
||
# Test that error message includes troubleshooting link | ||
err = nothing | ||
try | ||
sample(failing_model(), NUTS(), 10; progress=false) | ||
catch e | ||
err = e | ||
end | ||
|
||
@test err isa ErrorException | ||
@test contains( | ||
string(err), | ||
"https://turinglang.org/docs/usage/troubleshooting/#initial-parameters", | ||
) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works, but check out |
||
end | ||
|
||
end |
Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe the sentence "This may indicate an error with the model or AD backend" can go? The message is quite long, and I think the link gives a more nuanced explanation of what might be wrong.