eToxPred icon indicating copy to clipboard operation
eToxPred copied to clipboard

{Critical} Value Error: node array from pickle has incompatible dtype

Open theharshithh opened this issue 1 year ago • 5 comments

Hello, Thanks for this wonderful repo!

When i git clone and run this using python etoxpred_predict.py --datafile tcm600_nr.smi --modelfile etoxpred_best_model.joblib --outputfile results.csv (after unzippiing tar) i get this error:

...loading models
C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sklearn\base.py:376: InconsistentVersionWarning: Trying to unpickle estimator ExtraTreeClassifier from version 0.23.2 when using version 1.4.0. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\Sri Raghu\Desktop\swift-trials\ind-projects\eToxPred\etoxpred_predict.py", line 74, in <module>
    predict(opt)
  File "C:\Users\Sri Raghu\Desktop\swift-trials\ind-projects\eToxPred\etoxpred_predict.py", line 59, in predict
    clf = load(opt.modelfile)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\joblib\numpy_pickle.py", line 658, in load
    obj = _unpickle(fobj, filename, mmap_mode)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\joblib\numpy_pickle.py", line 577, in _unpickle
    obj = unpickler.load()
          ^^^^^^^^^^^^^^^^
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\pickle.py", line 1205, in load
PS C:\Users\Sri Raghu\Desktop\swift-trials\ind-projects\eToxPred> python etoxpred_predict.py --datafile tcm600_nr.smi --modelfile etoxpred_best_model.joblib --outputfile results.csv
...loading models
C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sklearn\base.py:376: InconsistentVersionWarning: Trying to unpickle estimator ExtraTreeClassifier from version 0.23.2 when using version 1.4.0. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\Sri Raghu\Desktop\swift-trials\ind-projects\eToxPred\etoxpred_predict.py", line 74, in <module>
    predict(opt)
  File "C:\Users\Sri Raghu\Desktop\swift-trials\ind-projects\eToxPred\etoxpred_predict.py", line 59, in predict
    clf = load(opt.modelfile)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\joblib\numpy_pickle.py", line 658, in load
    obj = _unpickle(fobj, filename, mmap_mode)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\joblib\numpy_pickle.py", line 577, in _unpickle
    obj = unpickler.load()
          ^^^^^^^^^^^^^^^^
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\pickle.py", line 1205, in load
    dispatch[key[0]](self)
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\site-packages\joblib\numpy_pickle.py", line 402, in load_build
    Unpickler.load_build(self)
  File "C:\Users\Sri Raghu\AppData\Local\Programs\Python\Python312\Lib\pickle.py", line 1710, in load_build
    setstate(state)
  File "sklearn\\tree\\_tree.pyx", line 865, in sklearn.tree._tree.Tree.__setstate__
  File "sklearn\\tree\\_tree.pyx", line 1571, in sklearn.tree._tree._check_node_ndarray
ValueError: node array from the pickle has an incompatible dtype:
- expected: {'names': ['left_child', 'right_child', 'feature', 'threshold', 'impurity', 'n_node_samples', 'weighted_n_node_samples', 'missing_go_to_left'], 'formats': ['<i8', '<i8', '<i8', '<f8', '<f8', '<i8', '<f8', 'u1'], 'offsets': [0, 8, 16, 24, 32, 40, 48, 56], 'itemsize': 64}
- got     : [('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]

I tired reducing sk-learn to base version -> didnt work installed MS visual tools and C++ tools -> didnt work

Kindly help me through this. Much Appreciated

theharshithh avatar Feb 06 '24 22:02 theharshithh