Skip to content

Commit 81ca26f

Browse files
authored
Bump DynamicPPL.jl, AdvancedVI, and Bijectors version (#1979)
* bump dppl test versions * also bump bijectors * bump AdvancedVI versions * revert Bijectors bump * bumped vi and bijectors too * breaking change * removed refernce to Bijectors.setadbackend * fixed VI * remove testing of Tracker.jl * relax prior tests a bit
1 parent 918f6f4 commit 81ca26f

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Turing"
22
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
3-
version = "0.24.4"
3+
version = "0.25.0"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
@@ -40,14 +40,14 @@ AbstractMCMC = "4"
4040
AdvancedHMC = "0.3.0, 0.4"
4141
AdvancedMH = "0.6.8, 0.7"
4242
AdvancedPS = "0.4"
43-
AdvancedVI = "0.1"
43+
AdvancedVI = "0.2"
4444
BangBang = "0.3"
45-
Bijectors = "0.8, 0.9, 0.10"
45+
Bijectors = "0.12"
4646
DataStructures = "0.18"
4747
Distributions = "0.23.3, 0.24, 0.25"
4848
DistributionsAD = "0.6"
4949
DocStringExtensions = "0.8, 0.9"
50-
DynamicPPL = "0.21.5"
50+
DynamicPPL = "0.21.5, 0.22"
5151
EllipticalSliceSampling = "0.5, 1"
5252
ForwardDiff = "0.10.3"
5353
Libtask = "0.7, 0.8"

src/essential/ad.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ setadbackend(backend_sym::Symbol) = setadbackend(Val(backend_sym))
66
function setadbackend(backend::Val)
77
_setadbackend(backend)
88
AdvancedVI.setadbackend(backend)
9-
Bijectors.setadbackend(backend)
109
end
1110

1211
function _setadbackend(::Val{:forwarddiff})
1312
ADBACKEND[] = :forwarddiff
1413
end
1514
function _setadbackend(::Val{:tracker})
15+
@warn "Usage of Tracker.jl with Turing.jl is no longer being actively tested and maintained; please use at your own risk. See Zygote.jl or ReverseDiff.jl for fully supported reverse-mode backends."
1616
ADBACKEND[] = :tracker
1717
end
1818
function _setadbackend(::Val{:zygote})

src/variational/VariationalInference.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
module Variational
22

3-
import AdvancedVI
4-
import Bijectors
5-
import DistributionsAD
6-
import DynamicPPL
7-
import StatsBase
8-
import StatsFuns
3+
using AdvancedVI
4+
using Bijectors
5+
using DistributionsAD
6+
using DynamicPPL
7+
using StatsBase
8+
using StatsFuns
9+
using Distributions
910

10-
import Random
11+
using Random
1112

1213
# Reexports
1314
using AdvancedVI: vi, ADVI, ELBO, elbo, TruncatedADAGrad, DecayedADAGrad

src/variational/advi.jl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# TODO(torfjelde): Find a better solution.
2-
struct Vec{N, B<:Bijectors.Bijector{N}} <: Bijectors.Bijector{1}
2+
struct Vec{N,B} <: Bijectors.Bijector
33
b::B
44
size::NTuple{N, Int}
55
end
66

77
Bijectors.inverse(f::Vec) = Vec(Bijectors.inverse(f.b), f.size)
88

9-
function (f::Vec)(x::AbstractVector)
9+
function Bijectors.with_logabsdet_jacobian(f::Vec, x)
10+
return Bijectors.transform(f, x), Bijectors.logabsdetjac(f, x)
11+
end
12+
13+
function Bijectors.transform(f::Vec, x::AbstractVector)
1014
# Reshape into shape compatible with wrapped bijector and then `vec` again.
1115
return vec(f.b(reshape(x, f.size)))
1216
end
1317

14-
function (f::Vec)(x::AbstractMatrix)
18+
function Bijectors.transform(f::Vec, x::AbstractMatrix)
1519
# At the moment we do batching for higher-than-1-dim spaces by simply using
1620
# lists of inputs rather than `AbstractArray` with `N + 1` dimension.
1721
cols = Iterators.Stateful(eachcol(x))
@@ -68,11 +72,10 @@ function Bijectors.bijector(
6872

6973
bs = map(tuple(dists...)) do d
7074
b = Bijectors.bijector(d)
71-
72-
return if Bijectors.dimension(b) > 1
73-
Vec(b, size(d))
74-
else
75+
if d isa Distributions.UnivariateDistribution
7576
b
77+
else
78+
Vec(b, size(d))
7679
end
7780
end
7881

test/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
3535
AbstractMCMC = "4"
3636
AdvancedMH = "0.6, 0.7"
3737
AdvancedPS = "0.4"
38-
AdvancedVI = "0.1"
38+
AdvancedVI = "0.2"
3939
Clustering = "0.14, 0.15"
4040
Distributions = "0.25"
4141
DistributionsAD = "0.6.3"
4242
DynamicHMC = "2.1.6, 3.0"
43-
DynamicPPL = "0.21.5"
43+
DynamicPPL = "0.21.5, 0.22"
4444
FiniteDifferences = "0.10.8, 0.11, 0.12"
4545
ForwardDiff = "0.10.12 - 0.10.32, 0.10"
4646
LogDensityProblems = "2"

test/inference/hmc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,6 @@
221221
alg = NUTS(1000, 0.8)
222222
gdemo_default_prior = DynamicPPL.contextualize(gdemo_default, DynamicPPL.PriorContext())
223223
chain = sample(gdemo_default_prior, alg, 10_000)
224-
check_numerical(chain, [:s, :m], [mean(InverseGamma(2, 3)), 0], atol=0.2)
224+
check_numerical(chain, [:s, :m], [mean(InverseGamma(2, 3)), 0], atol=0.3)
225225
end
226226
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ macro timeit_include(path::AbstractString) :(@timeit TIMEROUTPUT $path include($
6565
end
6666

6767
Turing.setrdcache(false)
68-
for adbackend in (:forwarddiff, :tracker, :reversediff)
68+
for adbackend in (:forwarddiff, :reversediff)
6969
@timeit TIMEROUTPUT "inference: $adbackend" begin
7070
Turing.setadbackend(adbackend)
7171
@info "Testing $(adbackend)"

0 commit comments

Comments
 (0)