Hi!
I’ve encountered an error when try to use to_netcdf() to save the idata of a BART model.
idata.to_netcdf(model_fpath)
ValueError: unable to infer dtype on variable ‘bart_trees’; xarray cannot serialize arbitrary Python objects
I’m currently using cloudpickle to save the idata instead, but I’m not sure if that’s the correct way of doing so.
# save
with open(model_fpath, 'wb') as buff:
cloudpickle.dump({'model': model, 'trace': idata}, buff)
# load
with open(model_fpath, 'rb') as buff:
saved_model = cloudpickle.load(buff)
model_copy = saved_model['model']
idata_copy = saved_model['trace']
What would be the recommended way of saving an idata with bart_trees?
Thank you for any help!