Saving intermediate traces

Thanks for the suggestion, I tried:

for i1 in range(5):
    with pm.Model() as model:

        BoundedNormal = pm.Bound(pm.Normal, lower=0.0)
        params = BoundedNormal('parameters',mu=0.5,sd=0.2,shape=(10,))

        likelihood_num = pm.Normal('y_num', mu=J_mcmc_num(params), sd = log10_std_num, observed = log10_measured_num)
        likelihood_weight = pm.Normal('y_weight', mu=J_mcmc_weight(params), sd = log10_std_weight, observed = log10_measured_weight)

        step = pm.Metropolis()

        if i1 == 0:
            trace = pm.sample(500,tune=500,step=step,chains=1,cores=1,start=None,trace=None,discard_tuned_samples=False)
        else:
            trace = pm.sample(500,tune=0,step=step,chains=1,cores=1,trace=trace,discard_tuned_samples=False)

        with open(os.path.join(outDir,traceFile), 'wb') as buff:
            pickle.dump({'model': model, 'trace': trace}, buff)

It still doesn’t do what I want however, as you can see the trace gets stuck after 1000 iterations:

I guess my question is related to the one in this thread?
https://discourse.pymc.io/t/pause-and-resume-training-a-model-that-can-change-during-training/3196/2

And thanks for suggesting the DEMetropolis step, will definitely give it a try!