код, который я использую:
Код: Выделить всё
import os
import xgboost as xgb
import pickle
import joblib
def convert_explainer_save_to_pkl(save_file, pkl_file):
print(f"Converting {save_file} to {pkl_file}")
explainer = joblib.load(save_file)
joblib.dump(explainer, pkl_file)
print(f"Explainer has been saved as {pkl_file}")
# Change working directory to /root
os.chdir('/root')
# Debugging: Print current working directory and list files
print("Current working directory:", os.getcwd())
print("Files in the current directory:", os.listdir('.'))
# Convert shap_explainer.save to shap_explainer.pkl
convert_explainer_save_to_pkl('shap_explainerEI.save', 'shap_explainer.pkl')
# Convert shap_explainerEI.save to shap_explainerEI.pkl
convert_explainer_save_to_pkl('shap_explainer.save', 'shap_explainerEI.pkl')
Код: Выделить всё
File "/var/lang/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 402, in load_build
Unpickler.load_build(self)
File "/var/lang/lib/python3.9/pickle.py", line 1717, in load_build
setstate(state)
File "/var/lang/lib/python3.9/site-packages/xgboost/core.py", line 1541, in __setstate__
_check_call(
File "/var/lang/lib/python3.9/site-packages/xgboost/core.py", line 246, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [13:25:23] ../include/xgboost/json.h:79: Invalid cast, from Array to Object
Подробнее здесь: https://stackoverflow.com/questions/792 ... -to-object
Мобильная версия