Skip to content

Commit

Permalink
Bump DynamicPPL to v0.28 (#2276)
Browse files Browse the repository at this point in the history
* Bump DynamicPPL to v0.28

* Also bump DPPL to v0.28 in tests

* Qualify use of getcontext
  • Loading branch information
mhauru authored Jun 26, 2024
1 parent a0db647 commit 927abcd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Distributions = "0.23.3, 0.24, 0.25"
DistributionsAD = "0.6"
DocStringExtensions = "0.8, 0.9"
DynamicHMC = "3.4"
DynamicPPL = "0.27.1"
DynamicPPL = "0.28"
Compat = "4.15.0"
EllipticalSliceSampling = "0.5, 1, 2"
ForwardDiff = "0.10.3"
Expand Down
2 changes: 1 addition & 1 deletion src/mcmc/Inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ getADType(::DynamicPPL.IsParent, ctx::DynamicPPL.AbstractContext) = getADType(Dy
getADType(alg::Hamiltonian) = alg.adtype

function LogDensityProblemsAD.ADgradient(ℓ::DynamicPPL.LogDensityFunction)
return LogDensityProblemsAD.ADgradient(getADType(.context), ℓ)
return LogDensityProblemsAD.ADgradient(getADType(DynamicPPL.getcontext(ℓ)), ℓ)
end

function LogDensityProblems.logdensity(
Expand Down
2 changes: 1 addition & 1 deletion src/mcmc/mh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function LogDensityProblems.logdensity(f::MHLogDensityFunction, x::NamedTuple)

x_old, lj_old = vi[sampler], getlogp(vi)
set_namedtuple!(vi, x)
vi_new = last(DynamicPPL.evaluate!!(f.model, vi, f.context))
vi_new = last(DynamicPPL.evaluate!!(f.model, vi, DynamicPPL.getcontext(f)))
lj = getlogp(vi_new)

# Reset old `vi`.
Expand Down
4 changes: 3 additions & 1 deletion src/optimisation/Optimisation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ required by Optimization.jl.
"""
function (f::OptimLogDensity)(z::AbstractVector)
varinfo = DynamicPPL.unflatten(f.varinfo, z)
return -DynamicPPL.getlogp(last(DynamicPPL.evaluate!!(f.model, varinfo, f.context)))
return -DynamicPPL.getlogp(
last(DynamicPPL.evaluate!!(f.model, varinfo, DynamicPPL.getcontext(f)))
)
end

(f::OptimLogDensity)(z, _) = f(z)
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Clustering = "0.14, 0.15"
Distributions = "0.25"
DistributionsAD = "0.6.3"
DynamicHMC = "2.1.6, 3.0"
DynamicPPL = "0.27"
DynamicPPL = "0.28"
FiniteDifferences = "0.10.8, 0.11, 0.12"
ForwardDiff = "0.10.12 - 0.10.32, 0.10"
HypothesisTests = "0.11"
Expand Down

0 comments on commit 927abcd

Please sign in to comment.