CmdStanPy "csv file header mismatch"

When I am running my fit using CmdStanPy using the following code:

fit = CmdStanModel(model_name='multipole_model', stan_file='model.stan')
mult_fit = fit.sample(data=data_multipoles, chains=8, iter_warmup=6250, iter_sampling=6250, 
                      adapt_delta = 0.99, max_treedepth =50, output_dir='.')

I am getting the following error:
csv file header mismatch, file path/multipole_model-202106091759-7.csv, key start_datetime is 2021-06-09 15:59:24 UTC, expected 2021-06-09 16:02:58 UTC

The error only occurs when I am using more than 4 chains.

1 Like

this was caused by addition of “start_datetime” to the Stan CSV header in 2.27.0 and has been fixed in CmdStanPy on the dev branch. will put a new version up on PyPi ASAP.


I think the logic should be reversed there to prevent false positives. Have a list of fields where csvs must match, not a list of fields that can be different.


that makes sense. the minimal list would be:

# model
# method
#  num_samples
#  num_warmup
#  save_warmup
#  thin
# engaged

this list is shorter than the current list of exceptions - thanks for the suggestion

edit: on second thought, this is not as straightforward as all that - different methods have different sets of CSV header tags, and although currently general practice is to only run one chain for optimization and advi, this might change.

1 Like

update: CmdStanPy 0.9.76 is now up on PyPi: cmdstanpy · PyPI