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

illegal type analysis, Turing InverseGamma model #2169

Closed
mhauru opened this issue Dec 5, 2024 · 4 comments
Closed

illegal type analysis, Turing InverseGamma model #2169

mhauru opened this issue Dec 5, 2024 · 4 comments

Comments

@mhauru
Copy link
Contributor

mhauru commented Dec 5, 2024

MWE:

module MWE

import Enzyme
import ADTypes
using Turing

adbackend = ADTypes.AutoEnzyme(; mode=Enzyme.Forward)

@model function gdemo_copy()
    s ~ InverseGamma(2, 3)
end
model = gdemo_copy()

alg = HMC(0.2, 4; adtype=adbackend)
sample(model, alg, 100)

end

Output: https://gist.github.com/mhauru/66d6f71f82eb5fe9476dc08c8f92e263

Enzyme v0.13.17. Affects both Forward and Reverse modes.

@wsmoses
Copy link
Member

wsmoses commented Dec 5, 2024

So this is indicative of a union (which isn't presently fully supported, at least without setting Enzyme.API.strictAliasing!(false) which may permit it).

Something around here https://github.com/TuringLang/DynamicPPL.jl/blob/2252a9b6012da8e2ac56353770a0f848f6874357/src/abstract_varinfo.jl#L791 is sometimes an int and other times a double. I think this will need to be fixed on the turing side.

@mhauru
Copy link
Contributor Author

mhauru commented Dec 5, 2024

If this is an error which may keep cropping up in normal use of Enzyme then simplifying the error message would be good.

@wsmoses
Copy link
Member

wsmoses commented Dec 5, 2024

oh yeah for sure, how about this? #2173

@wsmoses
Copy link
Member

wsmoses commented Dec 6, 2024

Improved error messages merged, better union support is already covered in other issues.

@wsmoses wsmoses closed this as completed Dec 6, 2024
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

No branches or pull requests

2 participants