Skip to content

Commit e720bea

Browse files
committed
Allowing resume_from to grab the previous state
1 parent 1d52c13 commit e720bea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/sampler.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,14 @@ function AbstractMCMC.sample(
9090
initial_state=loadstate(resume_from),
9191
kwargs...,
9292
)
93+
# Only use resume_from if initial_state wasn't manually provided
94+
init_state = initial_state
95+
if init_state === nothing && resume_from !== nothing
96+
init_state = loadstate(resume_from)
97+
end
98+
9399
return AbstractMCMC.mcmcsample(
94-
rng, model, sampler, N; chain_type, initial_state, kwargs...
100+
rng, model, sampler, N; chain_type, initial_state=init_state, kwargs...
95101
)
96102
end
97103

0 commit comments

Comments
 (0)