diff --git a/Project.toml b/Project.toml index e4b1c0b62..f8c04d7c7 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ AdvancedPS = "576499cb-2369-40b2-a588-c64705576edc" AdvancedVI = "b5ca4192-6429-45e5-a2d9-87aec30a685c" BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66" Bijectors = "76274a88-744f-5084-9051-94815aaf08c4" +Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c" @@ -48,7 +49,7 @@ TuringDynamicHMCExt = "DynamicHMC" TuringOptimExt = "Optim" [compat] -ADTypes = "1" +ADTypes = "0.2, 1" AbstractMCMC = "5.2" Accessors = "0.1" AdvancedHMC = "0.3.0, 0.4.0, 0.5.2, 0.6" @@ -63,6 +64,7 @@ DistributionsAD = "0.6" DocStringExtensions = "0.8, 0.9" DynamicHMC = "3.4" DynamicPPL = "0.27.1" +Compat = "4.15.0" EllipticalSliceSampling = "0.5, 1, 2" ForwardDiff = "0.10.3" Libtask = "0.7, 0.8" diff --git a/src/Turing.jl b/src/Turing.jl index 5562830af..4aa2fef2c 100644 --- a/src/Turing.jl +++ b/src/Turing.jl @@ -5,6 +5,7 @@ using DistributionsAD, Bijectors, StatsFuns, SpecialFunctions using Statistics, LinearAlgebra using Libtask @reexport using Distributions, MCMCChains, Libtask, AbstractMCMC, Bijectors +using Compat: pkgversion import AdvancedVI using DynamicPPL: DynamicPPL, LogDensityFunction @@ -107,7 +108,6 @@ export @model, # modelling AutoReverseDiff, AutoZygote, AutoTracker, - AutoTapir, setprogress!, # debugging @@ -144,6 +144,11 @@ export @model, # modelling MAP, MLE +# AutoTapir is only supported by ADTypes v1.0 and above. +@static if VERSION >= v"1.10" && pkgversion(ADTypes) >= v"1" + export AutoTapir +end + if !isdefined(Base, :get_extension) using Requires end diff --git a/src/essential/Essential.jl b/src/essential/Essential.jl index a3b2e4092..8cef7a681 100644 --- a/src/essential/Essential.jl +++ b/src/essential/Essential.jl @@ -11,7 +11,7 @@ using Bijectors: PDMatDistribution using AdvancedVI using StatsFuns: logsumexp, softmax @reexport using DynamicPPL -using ADTypes: ADTypes, AutoForwardDiff, AutoTracker, AutoReverseDiff, AutoZygote, AutoTapir +using ADTypes: ADTypes, AutoForwardDiff, AutoTracker, AutoReverseDiff, AutoZygote import AdvancedPS @@ -39,9 +39,14 @@ export @model, AutoTracker, AutoZygote, AutoReverseDiff, - AutoTapir, value, @logprob_str, @prob_str +# AutoTapir is only supported by ADTypes v1.0 and above. +@static if VERSION >= v"1.10" && pkgversion(ADTypes) >= v"1" + using ADTypes: AutoTapir + export AutoTapir +end + end # module