Load_trace and continue sampling

Hi guys,

I’ve tried to run a hierarchical model and saved the hierarchical trace as a multitrace.

with hierarchical_model:
step1 = pm.NUTS([intercept, slope_pre, slope_post])
step2 = pm.NUTS([switchpoint])

hierarchical_trace = pm.sample(10000, step=[step1,step2],progressbar=True, 
                  tune = 10000, burn = 4000, njobs=4,
                  nuts_kwargs=dict(target_accept=.99))

I am trying to add another 5000 samples to the trace with the following:

with hierarchical_model:
hierarchical_trace = pm.backends.ndarray.load_trace(‘hierarchical_trace’)

with hierarchical_model:
step1 = pm.NUTS([intercept, slope_pre, slope_post])
step2 = pm.NUTS([switchpoint])

hierarchical_trace_update = pm.sample(5000, step=[step1,step2], tune=1000, burn = 1000, 
                 chains=4, nchain=4, trace=hierarchical_trace, nuts_kwargs=dict(target_accept=.99))

I’ve got the following error:

217         """
218         trace_value = x.T

→ 219 nchain, n_samples = trace_value.shape
220
221 acov = np.asarray([autocov(trace_value[chain]) for chain in range(nchain)])

ValueError: not enough values to unpack (expected 2, got 1)

Can anyone help to see which part I did wrong? should add in the chain_idx=0 ?
Many thanks!