Hello, I’ve upgraded cmdstanpy to 1.2.0. When I try to create an InferenceData object with arviz==0.16.1 I get the below error. It works fine with cmdstanpy=1.1.0.
Get the same with the eight schools example.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[10], line 2
1 # Create id object
----> 2 idata_stan = az.from_cmdstanpy(
3 posterior=model_samples
4 )
File /usr/local/anaconda3/envs/xxx/lib/python3.10/site-packages/arviz/data/io_cmdstanpy.py:829, in from_cmdstanpy(posterior, posterior_predictive, predictions, prior, prior_predictive, observed_data, constant_data, predictions_constant_data, log_likelihood, index_origin, coords, dims, save_warmup, dtypes)
763 def from_cmdstanpy(
764 posterior=None,
765 *,
(...)
778 dtypes=None,
779 ):
780 """Convert CmdStanPy data into an InferenceData object.
781
782 For a usage example read the
(...)
827 InferenceData object
828 """
--> 829 return CmdStanPyConverter(
830 posterior=posterior,
831 posterior_predictive=posterior_predictive,
832 predictions=predictions,
833 prior=prior,
834 prior_predictive=prior_predictive,
835 observed_data=observed_data,
836 constant_data=constant_data,
837 predictions_constant_data=predictions_constant_data,
838 log_likelihood=log_likelihood,
839 index_origin=index_origin,
840 coords=coords,
841 dims=dims,
842 save_warmup=save_warmup,
843 dtypes=dtypes,
844 ).to_inference_data()
File /usr/local/anaconda3/envs/xxx/lib/python3.10/site-packages/arviz/data/io_cmdstanpy.py:76, in CmdStanPyConverter.__init__(self, posterior, posterior_predictive, predictions, prior, prior_predictive, observed_data, constant_data, predictions_constant_data, log_likelihood, index_origin, coords, dims, save_warmup, dtypes)
73 self.dtypes = dtypes
75 if hasattr(self.posterior, "metadata"):
---> 76 if self.log_likelihood is True and "log_lik" in self.posterior.metadata.stan_vars_cols:
77 self.log_likelihood = ["log_lik"]
78 elif hasattr(self.posterior, "stan_vars_cols"):
AttributeError: 'InferenceMetadata' object has no attribute 'stan_vars_cols'