-
Notifications
You must be signed in to change notification settings - Fork 599
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: unable to deserialize using cloudpickle #9793
Comments
From looking into this further, I think this is related to the fact that cloudpickle doesn't serialize functions with type annotations e.g. cloudpipe/cloudpickle#541. I see the same error with the following @ibis.udf.scalar.python
def add_one(x: int) -> int:
return x + 1
with open("func.pkl", "wb") as f:
cloudpickle.dump(add_one, f)
with open("func.pkl", "rb") as f:
loaded_model = cloudpickle.load(f) |
Perhaps there's an issue on our side.
|
To add to this issue, I've been investigating using import pickle
from ibis import _
import ibis
c = ibis.case().when(_.s == 1, "EXACT").when(True, "DIFFERENT").end()
pickle.loads(pickle.dumps(c)) raises PicklingError: Can't pickle <function _finish_searched_case at 0x78fdf8061900>: it's not the same object as ibis.expr.builders._finish_searched_case I am able to pickle/unpickle this using |
After a bit of hacking, I got this working:
|
The pickles expect a specific constructor for `Parameter`, so remove our custom constructor and provide a `classmethod` with the previous behavior for convenience. Closes #9793.
What happened?
I am using mlflow to log a model object that internally executes some transformations using
ibis
.Here's a minimal example of what I'm trying to do
However, this gives me a TypeError when trying to deserialize the object
The
mlflow.pyfunc.log_model
function internally usescloudpickle
to handle the serialization. I can reproduce this error using the followingI don't see this error when using
pickle
, so I suspect this is related to a difference in how these two libraries handle the serialization.It may be possible for me to specify
pickle
as the serialization method, which could be a work-around for nowWhat version of ibis are you using?
9.2.0
What backend(s) are you using, if any?
DuckDB
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: