I typically want to save the model as well, so just a small convenience function and python’s builtin pickle.
def pickle_model(output_path: str, model, trace):
"""Pickles PyMC3 model and trace"""
with open(output_path, "wb") as buff:
pickle.dump({"model": model, "trace": trace}, buff)