Unable to load trace

Hi all,

I’m encountering difficulties loading a saved trace (via pm.save_trace). I’m getting the following error:

~/anaconda3/envs/burn/lib/python3.7/site-packages/pymc3/backends/ndarray.py in load_trace(directory, model)
75 for directory in glob.glob(os.path.join(directory, ‘*’)):
76 if os.path.isdir(directory):
—> 77 straces.append(SerializeNDArray(directory).load(model))
78 return base.MultiTrace(straces)
79

~/anaconda3/envs/burn/lib/python3.7/site-packages/pymc3/backends/ndarray.py in load(self, model)
133 metadata = json.load(buff)
134
–> 135 metadata[’_stats’] = [{k: np.array(v) for k, v in stat.items()} for stat in metadata[’_stats’]]
136
137 for key, value in metadata.items():

TypeError: ‘NoneType’ object is not iterable

Explicitly specify the backend did not help. The folder is there, as well as the npz and json files …
(if the folder structure is not there, I get a different error)

Any suggestions highly welcome!
Thanks & best regards
Jan

2 Likes

Hi, I encountered exactly the same problem while using pymc3.load_trace() !
Unfortunately I have been stuck on this issue for many days but haven’t figured it out. I am trying to switch to “pickle” or “trace_to_dataframe” instead.
Please let me know if you have figured out this error. Thanks!

You should use arviz.to_netcdf