I am trying to load a serialized xgboost model from a pickle file.
import pickle
def load_pkl(fname):
with open(fname, 'rb') as f:
obj = pickle.load(f)
return obj
model = load_pkl('model_0_unrestricted.pkl')
while printing the model object, I am getting the following error in linux(AWS Sagemaker Notebook)
~/anaconda3/envs/python3/lib/python3.6/site-packages/xgboost/sklearn.py in get_params(self, deep)
436 if k == 'type' and type(self).__name__ != v:
437 msg = 'Current model type: {}, '.format(type(self).__name__) + \
--> 438 'type of model in file: {}'.format(v)
439 raise TypeError(msg)
440 if k == 'type':
~/anaconda3/envs/python3/lib/python3.6/site-packages/sklearn/base.py in get_params(self, deep)
193 out = dict()
194 for key in self._get_param_names():
--> 195 value = getattr(self, key)
196 if deep and hasattr(value, 'get_params'):
197 deep_items = value.get_params().items()
AttributeError: 'XGBClassifier' object has no attribute 'use_label_encoder'
Can you please help to fix the issue?
It is working fine in my local mac.
Ref: xgboost:1.4.1 installation log (Mac)
Collecting xgboost
Downloading xgboost-1.4.1-py3-none-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_11_0_x86_64.whl (1.2 MB)
But not working on AWS
Ref: xgboost:1.4.1 installation log (SM Notebook, linux machine)
Collecting xgboost
Using cached xgboost-1.4.1-py3-none-manylinux2010_x86_64.whl (166.7 MB)
Thanks