I’m able to run either chkpt_brms or chkpt_stan, interrupt and resume the run. But I want to close the R session and then resume it later, possibly another day.
With chkpt, I can save the step_size, metric file, and init file. But I can’t tell if there is a way to use this info when restarting chkpt_stan in the new. session. Alternatively, I can use them with mod$sample in cmdstanr, but then if I want to interrupt that, the next init file would have to be created by hand - awkward. Also, minor problem, $sample only takes one value of step_size rather then separate values for different chains (as in the chkpt output).
happy to give an example but that isn’t really the point for this question.
thanks
Greg
Operating System: Linux Mint 21.2 Victoria
brms Version: 2.22.0
Don’t forget to add relevant tags to your topic (top right of this form) especially for application area. Delete this text before posting your question :-) Thx!
I think this turned out to be trivial. As long as the data, stancode and standata are saved and can be reloaded in the new R session, chkptstanr will pick up where it left off.
fit1 ← chkpt_stan(model_code = stanc1,
data = stand1,
family = “gaussian”,
iter_adaptation = 1000,
iter_warmup = 100,
iter_per_chkpt = 100,
parallel_chains = 2,
control = list(max_treedepth=15),
path = ‘checkpt’)
stop the run somewhere after the adaptation stage, but in the midst of the checkpoints.
close the R session, stop and restart the machine, navigate to the same directory as before. Then reload the data etc and continue.
load(“stanc1.txt”,verbose=TRUE)
fit1 ← chkpt_stan(model_code = stanc1,
data = stand1,
family = “gaussian”,
iter_adaptation = 1000,
iter_warmup = 100,
iter_per_chkpt = 100,
parallel_chains = 2,
control = list(max_treedepth=15),
path = ‘checkpt’)