Open
Description
Hey,
executing the below minimum working example will error
import pickle
from efficientnet.keras import preprocess_input
with open("test.pkl", "wb") as fh:
pickle.dump(preprocess_input, fh)
with
_pickle.PicklingError: Can't pickle <function preprocess_input at 0x7f1c565d94d0>: it's not the same object as efficientnet.model.preprocess_input
.
Reason for this is that functools.wraps
used to inject the preprocessing here per default updates the __module__
etc. of the wrapper function to look like the wrapped function, see here.
Quick and dirty solution is to set the __module__
property explicitly, but that is certainly not very elegant.
Metadata
Metadata
Assignees
Labels
No labels