From 9f3ab016baf30207b91e7fdc5fa0a9a1d468cf39 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Mon, 31 Jul 2023 19:42:03 +0100 Subject: [PATCH] Bugfix in model evaluation not using SMC samplers (#2057) * Update AdvancedSMC.jl * Update Project.toml --- Project.toml | 2 +- src/inference/AdvancedSMC.jl | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 2e1b5e3d3..b0251a598 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Turing" uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" -version = "0.28" +version = "0.28.1" [deps] diff --git a/src/inference/AdvancedSMC.jl b/src/inference/AdvancedSMC.jl index ff80553db..22c5b6140 100644 --- a/src/inference/AdvancedSMC.jl +++ b/src/inference/AdvancedSMC.jl @@ -331,15 +331,16 @@ function DynamicPPL.assume( vn::VarName, __vi__::AbstractVarInfo ) - local vi - trace = AdvancedPS.current_trace() - trng = trace.rng + local vi, trng try + trace = AdvancedPS.current_trace() + trng = trace.rng vi = trace.model.f.varinfo catch e # NOTE: this heuristic allows Libtask evaluating a model outside a `Trace`. if e == KeyError(:__trace) || current_task().storage isa Nothing vi = __vi__ + trng = rng else rethrow(e) end