Skip to content

Commit 9cbb2e9

Browse files
committed
fix make_evaluate_...
1 parent c630723 commit 9cbb2e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/mcmc/particle_mcmc.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ function TracedModel(
1818
varinfo::AbstractVarInfo,
1919
rng::Random.AbstractRNG,
2020
)
21-
context = DynamicPPL.SamplingContext(rng, sampler, DefaultContext())
22-
args, kwargs = DynamicPPL.make_evaluate_args_and_kwargs(model, varinfo, context)
21+
spl_context = DynamicPPL.SamplingContext(rng, sampler, model.context)
22+
spl_model = DynamicPPL.contextualize(model, spl_context)
23+
args, kwargs = DynamicPPL.make_evaluate_args_and_kwargs(spl_model, varinfo)
2324
if kwargs !== nothing && !isempty(kwargs)
2425
error(
2526
"Sampling with `$(sampler.alg)` does not support models with keyword arguments. See issue #2007 for more details.",
2627
)
2728
end
2829
return TracedModel{AbstractSampler,AbstractVarInfo,Model,Tuple}(
29-
model, sampler, varinfo, (model.f, args...)
30+
spl_model, sampler, varinfo, (spl_model.f, args...)
3031
)
3132
end
3233

0 commit comments

Comments
 (0)