TuringLang / Turing.jl

Bayesian inference with probabilistic programming.
https://turinglang.org
MIT License
2.04k stars 219 forks source link

Switch to ReverseDiff for default AD? #1164

Closed yebai closed 2 years ago

yebai commented 4 years ago

Are there any known issues that could prevent a switch? If not, maybe consider switching the default AD to ReverseDiff after https://github.com/TuringLang/DistributionsAD.jl/pull/44 is merged? Based on our benchmarks, ReverseDiff provides the most efficient reverse-mode AD implementation at the moment.

mohamed82008 commented 4 years ago

It might be good to have a macro that prettifies custom adjoints in ReverseDiff for users.

mohamed82008 commented 4 years ago

Some users like to define their own adjoints.

yebai commented 4 years ago

It might be good to have a macro that prettifies custom adjoints in ReverseDiff for users.

That would be great!

yebai commented 4 years ago

@mohamed82008 It seems the new DistributionsAD release introduced some issues, see

 [6] include_relative(::Module, ::String) at ./loading.jl:1044
 [7] include at ./sysimg.jl:29 [inlined]
 [8] include(::String) at /home/runner/.julia/packages/DistributionsAD/U9qRl/src/DistributionsAD.jl:1
 [9] top-level scope at none:0
 [10] include at ./boot.jl:317 [inlined]
 [11] include_relative(::Module, ::String) at ./loading.jl:1044
 [12] include(::Module, ::String) at ./sysimg.jl:29
 [13] top-level scope at none:2
 [14] eval at ./boot.jl:319 [inlined]
 [15] eval(::Expr) at ./client.jl:393
 [16] top-level scope at ./none:3
in expression starting at /home/runner/.julia/packages/DistributionsAD/U9qRl/src/reversediff.jl:392
in expression starting at /home/runner/.julia/packages/DistributionsAD/U9qRl/src/DistributionsAD.jl:55
ERROR: LoadError: Failed to precompile DistributionsAD [ced4e74d-a319-5a8a-b0ac-84af2272839c] to /home/runner/.julia/compiled/v1.0/DistributionsAD/mhHYG.ji.

https://github.com/TuringLang/Turing.jl/runs/524084297?check_suite_focus=true#step:4:251

mohamed82008 commented 4 years ago

Interesting. It's weird that I didn't get this error in DistributionsAD tests on Julia 1.0. I will fix it, it is simple enough.

mohamed82008 commented 4 years ago

I restarted the tests, seem to be fine now.