-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: as_op not pickled, making parallel SMC crash #7078
Comments
|
@aloctavodia Given all your work on SMC and its parallelization (in particular #3981), would you have any idea what's going on, please, and how to add those ops to what's being pickled, please? Thanks a lot for any idea :) |
May want to try and define the Op in a python script instead of at runtime |
Thanks for the idea! I'll try this workaround and report here. Not ideal on
the long-term (single-file example being very handy for what I'm trying to
achieve pedagogically) but I'll definitely take it if it works :-)
…On Thu, Dec 28, 2023, 14:01 Ricardo Vieira ***@***.***> wrote:
May want to try and define the Op in a python script instead of at runtime
—
Reply to this email directly, view it on GitHub
<#7078 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFBEROZGWK7D7TXTL2RBUTYLVUSFAVCNFSM6AAAAABBE3UKOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGE2TMOBUGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@ricardoV94 That workaround works!! 🎉 Awesome, that'll be perfect until a longer-time fix works :) Now the smc sampler is hitting another issue lower down, which could also be related to pickling but seems linked to the progress bar, complaining about
|
Dang, the latter seems to be related to AnswerDotAI/fastprogress#32 and #5855 and #5980 , none of which seems to have had an actual resolution :/ |
A really ugly workaround is to call |
I confirm that the problem with fastprogress only occurs with
Inspecting its code in https://github.com/fastai/fastprogress/blob/master/fastprogress/fastprogress.py#L104 confirms that it checks its import of |
The way I understand it, both problems come down to the fact that the "manual" serialization is missing some symbols: the local op in one case, or the HTML object imported by fastprogress when it is itself imported in the other. I'm not strong enough about closures and namespaces in Python to pinpoint exactly how to spot these missing symbols, capture them, and reserialize them, but I would bet good money it should be done at this point in the SMC sampler code: Line 385 in 118be0f
I'd be happy to work with anyone here to enrich this serialization! |
OK, progress bar error figured out: it's not quite due to pickling, it's due to how So that'll be one of two problems sorted :) |
PR opened to fix the progress bar bug :) |
Describe the issue:
As it stands, SMC sampler cannot be parallelized with custom ops.
When using SMC sampler with more than one core (i.e. parallel sampling) and an
as_op
custom op, the op is not pickled properly in the "manual" pickling atpymc/pymc/smc/sampling.py
Line 385 in 118be0f
Reproduceable code example:
Error message:
PyMC version information:
pymc: 5.10.3
pytensor: 2.18.4
python: 3.11.7
Installed in a fresh conda environment with
conda create -c conda-forge -n pymc_env "pymc>=5"
Context for the issue:
As it stands, SMC sampler cannot run the official PyMC example from https://www.pymc.io/projects/examples/en/latest/ode_models/ODE_Lotka_Volterra_multiple_ways.html
Any simple ODE where sunode is overkill will crash similarly, as it requires a custom op, that is not pickled.
The workaround of using a single core makes the method much slower than needed.
Is there a way to serialize the custom operation please?
The text was updated successfully, but these errors were encountered: