You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Hey,
executing the below minimum working example will error
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.The text was updated successfully, but these errors were encountered: