joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
346 stars 76 forks source link

Errors in declaring checkpoint file. #433

Closed Pengxuan-Zhu-Phys closed 1 year ago

Pengxuan-Zhu-Phys commented 1 year ago

Dynesty version Specify the exact version, and how you installed it (pip/git) I am using dynasty version 2.1.0, and install it via git Your question I am using dynesty as my sampling algorithm in my project, but I am encountering an error when declaring the checkpoint file in the run_nested function. This may be due to my likelihood function needing to call the Popen function from the subprocess library. The error message prompted by dynesty is as follows:

Traceback (most recent call last): ... File ".../dynesty/py/dynesty/utils.py", line 2318, in save_sampler pickle_module.dump(D, fp) TypeError: cannot pickle 'PyCapsule' object

I am wondering how to modify my code, or if there is another way to save only the data when checkpointing, and then restore from the data file during recovery, instead of saving the entire sampler object?

segasai commented 1 year ago

Please take a look at the last question of the FAQ that addresses that specific issue

https://dynesty.readthedocs.io/en/stable/faq.html

Pengxuan-Zhu-Phys commented 1 year ago

Thank you, my code is running, and looks fine