I have a model which i have saved in a pickle format as follows:
# Saving the model based on the best parameters
joblib.dump(pipeline, "model/model.pkl")
# I tested it by loading in pickle format
model = joblib.load("model/model.pkl")
and it works fine.
My problem is when I try to load the model in another script, i get the following error.
MODEL_FILE = "./model/model.pkl"
model = joblib.load(MODEL_FILE)
File "C:Python311Libpickle.py", line 331, in _getattribute
raise AttributeError("Can't get attribute {!r} on {!r}"
AttributeError: Can't get attribute 'WoE_Binning' on <module '__main__' from 'c:\xxxxx\app\main.py'>
File "C:Python311Libpickle.py", line 331, in _getattribute
raise AttributeError("Can't get attribute {!r} on {!r}"
AttributeError: Can't get attribute 'WoE_Binning' on <module '__main__' (<_frozen_importlib_external.SourceFileLoader object at 0x00000218454752D0>
What went wrong?
Thank you