@@ -158,7 +158,6 @@ function mcmcsample(
158158 elseif progress === false
159159 progress = NoLogging ()
160160 end
161- init_progress (progress)
162161
163162 # Determine how many samples to drop from `num_warmup` and the
164163 # main sampling process before we start saving samples.
@@ -170,6 +169,7 @@ function mcmcsample(
170169 local state
171170
172171 @withprogresslogger begin
172+ init_progress (progress)
173173 # Determine threshold values for progress logging
174174 # (one update per 0.5% of progress)
175175 n_updates = progress isa ChannelProgress ? progress. n_updates : 200
@@ -310,7 +310,6 @@ function mcmcsample(
310310 elseif progress === false
311311 progress = NoLogging ()
312312 end
313- init_progress (progress)
314313
315314 # Determine how many samples to drop from `num_warmup` and the
316315 # main sampling process before we start saving samples.
@@ -322,6 +321,7 @@ function mcmcsample(
322321 local state
323322
324323 @withprogresslogger begin
324+ init_progress (progress)
325325 # Obtain the initial sample and state.
326326 sample, state = if num_warmup > 0
327327 if initial_state === nothing
@@ -384,10 +384,10 @@ function mcmcsample(
384384 # Increment iteration counter.
385385 i += 1
386386 end
387+ finish_progress (progress)
387388 end
388389
389390 # Get the sample stop time.
390- finish_progress (progress)
391391 stop = time ()
392392 duration = stop - start
393393 stats = SamplingStats (start, stop, duration)
0 commit comments