从保存的模型预测值时出错

时间:2020-08-05 17:08:26

标签: python joblib

我的朋友使用joblib.dump()保存了决策树模型。但是,当我尝试使用保存的模型中的某些数据进行预测时,出现以下错误。谁能告诉我为什么会这样?我的朋友和我所有必需库的版本都相同

Traceback (most recent call last):
  File "testing.py", line 12, in <module>
    classifier = joblib.load('saved_model.pkl')
  File "C:\Users\naiks\AppData\Local\Programs\Python\Python38-32\lib\site-packages\joblib\numpy_pickle.py", line 585, in load
    obj = _unpickle(fobj, filename, mmap_mode)
  File "C:\Users\naiks\AppData\Local\Programs\Python\Python38-32\lib\site-packages\joblib\numpy_pickle.py", line 504, in _unpickle
    obj = unpickler.load()
  File "C:\Users\naiks\AppData\Local\Programs\Python\Python38-32\lib\pickle.py", line 1210, in load
    dispatch[key[0]](self)
  File "C:\Users\naiks\AppData\Local\Programs\Python\Python38-32\lib\pickle.py", line 1587, in load_reduce
    stack[-1] = func(*args)
  File "sklearn\tree\_tree.pyx", line 607, in sklearn.tree._tree.Tree.__cinit__
ValueError: Buffer dtype mismatch, expected 'SIZE_t' but got 'long long'

1 个答案:

答案 0 :(得分:0)

我使用的是32位版本的python,而训练模型的机器使用的是64位python。因此缓冲区大小不同,从而导致错误