调用时未知 gbm 类型 joblib.load
Unknown gbm type when invoke joblib.load
我用joblib.load
加载训练好的模型文件xgboost.m(其他win10电脑训练模型),但是不行:
model = joblib.load('xgboost.m')
我的电脑也是win10,但是执行代码时出现错误:
2020-06-16 20:47:48 [1832] ERROR XgboostAlgObj.py:70: - Traceback (most recent call last):
File "D:/iWork/pp/python-schedule/oritek/task/component/XgboostAlgObj.py", line 67, in execute
return self.xgboost(chk_date, dest_equips, busi_type, equip_code,flag)
File "D:/iWork/pp/python-schedule/oritek/task/component/XgboostAlgObj.py", line 37, in xgboost
pred = model_predict.predict(busi_type,equip_code,chk_date[0:7],self.predict_time,equip_code)
File "D:\iWork\pp\python-schedule\oritek\task\component\model_predict.py", line 156, in predict
model = joblib.load('xgboost.m')
File "C:\ProgramData\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 585, in load
obj = _unpickle(fobj, filename, mmap_mode)
File "C:\ProgramData\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 504, in _unpickle
obj = unpickler.load()
File "C:\ProgramData\Anaconda3\lib\pickle.py", line 1085, in load
dispatch[key[0]](self)
File "C:\ProgramData\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 329, in load_build
Unpickler.load_build(self)
File "C:\ProgramData\Anaconda3\lib\pickle.py", line 1549, in load_build
setstate(state)
File "C:\ProgramData\Anaconda3\lib\site-packages\xgboost\core.py", line 981, in __setstate__
_check_call(_LIB.XGBoosterLoadModelFromBuffer(handle, ptr, length))
File "C:\ProgramData\Anaconda3\lib\site-packages\xgboost\core.py", line 176, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [20:47:48] C:\Jenkins\workspace\xgboost-win64_release_0.90\src\gbm\gbm.cc:20: Unknown gbm type
Exception ignored in: <function Booster.__del__ at 0x0000020E4CC3F730>
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\xgboost\core.py", line 957, in __del__
AttributeError: 'Booster' object has no attribute 'handle'
可能导致问题的原因是什么?谢谢!
可能是因为该模型是在与您环境中使用的 xgboost 版本不同的 xgboost 版本中训练的
我用joblib.load
加载训练好的模型文件xgboost.m(其他win10电脑训练模型),但是不行:
model = joblib.load('xgboost.m')
我的电脑也是win10,但是执行代码时出现错误:
2020-06-16 20:47:48 [1832] ERROR XgboostAlgObj.py:70: - Traceback (most recent call last):
File "D:/iWork/pp/python-schedule/oritek/task/component/XgboostAlgObj.py", line 67, in execute
return self.xgboost(chk_date, dest_equips, busi_type, equip_code,flag)
File "D:/iWork/pp/python-schedule/oritek/task/component/XgboostAlgObj.py", line 37, in xgboost
pred = model_predict.predict(busi_type,equip_code,chk_date[0:7],self.predict_time,equip_code)
File "D:\iWork\pp\python-schedule\oritek\task\component\model_predict.py", line 156, in predict
model = joblib.load('xgboost.m')
File "C:\ProgramData\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 585, in load
obj = _unpickle(fobj, filename, mmap_mode)
File "C:\ProgramData\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 504, in _unpickle
obj = unpickler.load()
File "C:\ProgramData\Anaconda3\lib\pickle.py", line 1085, in load
dispatch[key[0]](self)
File "C:\ProgramData\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 329, in load_build
Unpickler.load_build(self)
File "C:\ProgramData\Anaconda3\lib\pickle.py", line 1549, in load_build
setstate(state)
File "C:\ProgramData\Anaconda3\lib\site-packages\xgboost\core.py", line 981, in __setstate__
_check_call(_LIB.XGBoosterLoadModelFromBuffer(handle, ptr, length))
File "C:\ProgramData\Anaconda3\lib\site-packages\xgboost\core.py", line 176, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [20:47:48] C:\Jenkins\workspace\xgboost-win64_release_0.90\src\gbm\gbm.cc:20: Unknown gbm type
Exception ignored in: <function Booster.__del__ at 0x0000020E4CC3F730>
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\xgboost\core.py", line 957, in __del__
AttributeError: 'Booster' object has no attribute 'handle'
可能导致问题的原因是什么?谢谢!
可能是因为该模型是在与您环境中使用的 xgboost 版本不同的 xgboost 版本中训练的