-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Cloudpickle compatibility #759
Comments
Hi @samimia-swks,
Unfortunately it seems that Param doesn't support it out of the box, even for very simple cases like the one you tried above. It'd be nice to add support for |
Hi @maximlt, I was able to figure out that cloudpickle (or dill) support was broken by #386 which is between version 1.9.3 and 1.10.0. If I remove the offending lines of code, which are the definition setstate() method for the Parameters class, I can get cloudpickle to pickle a Parametrized class with both lambdas and @param.depends() decorators even on the latest 1.13.0 version : def __setstate__(self, state):
# Set old parameters state on Parameterized._parameters_state
self_or_cls = state.get('self', state.get('cls'))
for k in self_or_cls._parameters_state:
key = '_'+k
if key in state:
self_or_cls._parameters_state[k] = state.pop(key)
for k, v in state.items():
setattr(self, k, v) From what I understand, this is a method that's called by Perhaps @philippjfr, who authored this code can clarify. |
Thanks @samimia-swks I'm sure that's going to be very helpful! |
params 1.13.0
cloudpickle 2.2.1
python 3.11
Ubuntu 22.04
The docs recommend Cloudpickle as a way to pickle Parameterized classes with lambda functions, but even the most basic Parameterized object (with or without lambdas) cannot be pickled with cloudpickle :
Output
The text was updated successfully, but these errors were encountered: