'Loading xgboost regressor model but getting BoostLearner: wrong model format

I'm facing this problem.

I have an xgboost Regressor model saved as a feather file as follows:

model.save_model(PATH_TO_MODEL)

and I'm trying to load the feather file as follows:

model = XGBRegressor()
model.load_model(model_path)

Unfortunately it is not working and I have been trying so many different versions but no luck.

I'm getting this error:

XGBoostError: [06:30:35] /Users/runner/work/xgboost/xgboost/src/learner.cc:783: Check failed: fi->Read(&mparam_, sizeof(mparam_)) == sizeof(mparam_) (0 vs. 136) : BoostLearner: wrong model format Stack trace: [bt] (0) 1 libxgboost.dylib 0x000000014ebd4814 dmlc::LogMessageFatal::~LogMessageFatal() + 116 [bt] (1) 2 libxgboost.dylib 0x000000014ec7ae46 xgboost::LearnerIO::LoadModel(dmlc::Stream*) + 2054 [bt] (2) 3 libxgboost.dylib 0x000000014ebce183 XGBoosterLoadModel + 419 [bt] (3) 4 libffi.7.dylib 0x0000000102640ead ffi_call_unix64 + 85 [bt] (4) 5 ??? 0x00007ffeee14bd50 0x0 + 140732892757328

Does anyone know what I can do ?



Solution 1:[1]

Check model_path, your model file is empty.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sol