Skip to content

Commit

Permalink
depend on DynamicPPL.jl instead of Turing.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Feb 27, 2024
1 parent 5c27074 commit 0dafcce
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.4.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand All @@ -14,7 +15,6 @@ LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[weakdeps]
Expand All @@ -25,15 +25,15 @@ TuringBenchmarkingBridgeStanExt = "BridgeStan"

[compat]
ADTypes = "0.2"
AbstractMCMC = "5"
BenchmarkTools = "1"
BridgeStan = "2"
DynamicPPL = "0.23, 0.24"
DynamicPPL = "0.24.7"
LogDensityProblems = "2"
LogDensityProblemsAD = "1"
PrettyTables = "2"
Requires = "1"
ReverseDiff = "1.14"
Turing = "0.30"
Zygote = "0.6"
julia = "1.6"

Expand Down
3 changes: 2 additions & 1 deletion src/TuringBenchmarking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ using BenchmarkTools
using LogDensityProblems
using LogDensityProblemsAD

using Turing
using DynamicPPL
using ADTypes

using PrettyTables: PrettyTables

using AbstractMCMC: AbstractMCMC
using DynamicPPL: DynamicPPL

# Load some the default backends to trigger conditional loading.
Expand Down
4 changes: 3 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
9 changes: 4 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TuringBenchmarking
using BenchmarkTools
using Turing
using DynamicPPL, Distributions, DistributionsAD
using Test
using ADTypes

Expand All @@ -17,7 +17,7 @@ ADBACKENDS = TuringBenchmarking.DEFAULT_ADBACKENDS

@testset "TuringBenchmarking.jl" begin
@testset "Item-Response model" begin
### Setup ###
# Simulate data.
function sim(I, P)
yvec = Vector{Int}(undef, I * P)
ivec = similar(yvec)
Expand All @@ -38,12 +38,11 @@ ADBACKENDS = TuringBenchmarking.DEFAULT_ADBACKENDS
end
y, i, p, _, _ = sim(5, 3)

### Turing ###
# performant model
# Performant model.
@model function irt(y, i, p; I=maximum(i), P=maximum(p))
theta ~ filldist(Normal(), P)
beta ~ filldist(Normal(), I)
Turing.@addlogprob! sum(logpdf.(BernoulliLogit.(theta[p] - beta[i]), y))
DynamicPPL.@addlogprob! sum(logpdf.(BernoulliLogit.(theta[p] - beta[i]), y))

return (; theta, beta)
end
Expand Down

0 comments on commit 0dafcce

Please sign in to comment.