From ada3b1b7dc8d1e22f0f6f11c70f8f7cdf9d25bda Mon Sep 17 00:00:00 2001 From: Alexandre Bouchard Date: Sat, 28 Oct 2023 14:55:27 -0700 Subject: [PATCH 1/5] Reactivate test --- test/test_turing.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_turing.jl b/test/test_turing.jl index ff4a47414..8cde88424 100644 --- a/test/test_turing.jl +++ b/test/test_turing.jl @@ -4,16 +4,16 @@ include("supporting/turing_models.jl") The reason this test is excluded is described in ADgradient() in TuringLogPotential.jl =# -# @testset "Turing-gradient" begin -# target = Pigeons.toy_turing_unid_target() +@testset "Turing-gradient" begin + target = Pigeons.toy_turing_unid_target() -# @show Threads.nthreads() + @show Threads.nthreads() -# logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(adapt_pre_conditioning = false))) -# logz_slicer = Pigeons.stepping_stone_pair(pigeons(; target, explorer = SliceSampler())) + logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(adapt_pre_conditioning = false))) + logz_slicer = Pigeons.stepping_stone_pair(pigeons(; target, explorer = SliceSampler())) -# @test abs(logz_mala[1] - logz_slicer[1]) < 0.1 -# end + @test abs(logz_mala[1] - logz_slicer[1]) < 0.1 +end @testset "Turing-variable-names" begin pt = pigeons(target = TuringLogPotential(model_with_vectors()), n_rounds = 2); From 9a715364b1c1fd2dea16360b3f677b031777dd0a Mon Sep 17 00:00:00 2001 From: Alexandre Bouchard Date: Sun, 29 Oct 2023 20:06:02 -0700 Subject: [PATCH 2/5] Fix interface change --- test/test_turing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_turing.jl b/test/test_turing.jl index 8cde88424..b7247ce1a 100644 --- a/test/test_turing.jl +++ b/test/test_turing.jl @@ -9,7 +9,7 @@ ADgradient() in TuringLogPotential.jl @show Threads.nthreads() - logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(adapt_pre_conditioning = false))) + logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(preconditioner = Pigeons.IdentityPreconditioner()))) logz_slicer = Pigeons.stepping_stone_pair(pigeons(; target, explorer = SliceSampler())) @test abs(logz_mala[1] - logz_slicer[1]) < 0.1 From 009c9f74233d7f05e9b23013a6e1a43725ae3898 Mon Sep 17 00:00:00 2001 From: Alexandre Bouchard Date: Mon, 30 Oct 2023 09:47:19 -0700 Subject: [PATCH 3/5] Triple checking that the problem does not arise with a pure Julia target --- test/test_turing.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_turing.jl b/test/test_turing.jl index b7247ce1a..51f9ccfe3 100644 --- a/test/test_turing.jl +++ b/test/test_turing.jl @@ -1,5 +1,17 @@ include("supporting/turing_models.jl") + +@testset "Non-turing-gradient" begin + target = Pigeons.toy_mvn_target(2) + + @show Threads.nthreads() + + logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(preconditioner = Pigeons.IdentityPreconditioner()))) + logz_slicer = Pigeons.stepping_stone_pair(pigeons(; target, explorer = SliceSampler())) + + @test abs(logz_mala[1] - logz_slicer[1]) < 0.1 +end + #= The reason this test is excluded is described in ADgradient() in TuringLogPotential.jl From 02c43af889e3c629c8f0310a3eefd847429f198f Mon Sep 17 00:00:00 2001 From: Alexandre Bouchard Date: Mon, 30 Oct 2023 20:52:43 -0700 Subject: [PATCH 4/5] Fix name change not that was not propagated --- ext/PigeonsDynamicPPLExt/state.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/PigeonsDynamicPPLExt/state.jl b/ext/PigeonsDynamicPPLExt/state.jl index 96ef2d27d..8e75b6589 100644 --- a/ext/PigeonsDynamicPPLExt/state.jl +++ b/ext/PigeonsDynamicPPLExt/state.jl @@ -52,7 +52,7 @@ end function Pigeons.step!(explorer::AutoMALA, replica, shared, vi::DynamicPPL.TypedVarInfo) log_potential = Pigeons.find_log_potential(replica, shared.tempering, shared) state = DynamicPPL.getall(vi) - Pigeons._extract_commons_and_run_auto_mala!(explorer, replica, shared, log_potential, state) + Pigeons._extract_commons_and_run!(explorer, replica, shared, log_potential, state) DynamicPPL.setall!(replica.state, state) end From 9987e352650fe4f83e46a9bb2fae9fc60ef53df2 Mon Sep 17 00:00:00 2001 From: Alexandre Bouchard Date: Tue, 31 Oct 2023 08:38:48 -0700 Subject: [PATCH 5/5] Restore same order as before --- test/test_turing.jl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/test_turing.jl b/test/test_turing.jl index 51f9ccfe3..5b8e26815 100644 --- a/test/test_turing.jl +++ b/test/test_turing.jl @@ -1,16 +1,7 @@ include("supporting/turing_models.jl") -@testset "Non-turing-gradient" begin - target = Pigeons.toy_mvn_target(2) - - @show Threads.nthreads() - - logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(preconditioner = Pigeons.IdentityPreconditioner()))) - logz_slicer = Pigeons.stepping_stone_pair(pigeons(; target, explorer = SliceSampler())) - @test abs(logz_mala[1] - logz_slicer[1]) < 0.1 -end #= The reason this test is excluded is described in @@ -30,4 +21,15 @@ end @testset "Turing-variable-names" begin pt = pigeons(target = TuringLogPotential(model_with_vectors()), n_rounds = 2); @test length(variable_names(pt)) == 4 +end + +@testset "Non-turing-gradient" begin + target = Pigeons.toy_mvn_target(2) + + @show Threads.nthreads() + + logz_mala = Pigeons.stepping_stone_pair(pigeons(; target, explorer = AutoMALA(preconditioner = Pigeons.IdentityPreconditioner()))) + logz_slicer = Pigeons.stepping_stone_pair(pigeons(; target, explorer = SliceSampler())) + + @test abs(logz_mala[1] - logz_slicer[1]) < 0.1 end \ No newline at end of file