Skip to content

Commit

Permalink
Fixing bug in save_model_to_file
Browse files Browse the repository at this point in the history
  • Loading branch information
hposborn committed Jul 10, 2024
1 parent e786e11 commit d433f4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MonoTools/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def load_model_from_file(self, loadfile=None):
for key in pick:
setattr(self,key,pick[key])
del pick
setattr(self,'trace',az.InferenceData.from_netcdf(loadfile.replace('_model.pickle','_trace.nc')))
setattr(self,'trace',az.InferenceData.from_netcdf(loadfile.replace('_model.pickle','_trace.nc')).stack())
elif os.path.exists(loadfile):
#Loading old version using pickle from pickled dictionary
pick=pickle.load(open(loadfile,'rb'))
Expand Down Expand Up @@ -216,7 +216,7 @@ def save_model_to_file(self, savefile=None, limit_size=False):
except:
print("Still a save error after unstacking")
excl_types=[az.InferenceData]
cloudpickle.dumps({attr:getattr(self,attr) for attr in self.__dict__},open(savefile,'wb'))
cloudpickle.dump({attr:getattr(self,attr) for attr in self.__dict__ if type(getattr(self,attr)) not in excl_types},open(savefile,'wb'))

# #Loading from pickled dictionary
# saving={}
Expand Down

0 comments on commit d433f4e

Please sign in to comment.