Operating System: Ubuntu 18.04.3
CPU/GPU model: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
C++/Python/R version: C++ 11
LightGBM version or commit hash: 8f7199a
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
int main(int argc, char** argv) {
BoosterHandle handle;
int p;
auto model = LGBM_BoosterCreateFromModelfile("model.txt", &p, &handle);
if(model != 0){
cout << "Fail On Loaded!" << endl;
exit(-1);
}
else{
cout << "Success" << endl;
cout << p << endl;
}
vector<double> test{1, 3466, 3, 4, 1, 3456, -1, 0, 14, 34, 30};
void* in_p = static_cast<void*>(test.data());
std::vector<double> out(1, 0);
auto* out_result = static_cast<double*>(out.data());
int64_t out_len;
auto result = LGBM_BoosterPredictForMatSingleRow(&handle, in_p, C_API_DTYPE_FLOAT64, 11, 1, C_API_PREDICT_NORMAL, -1, "", &out_len, out_result);
return 0;
}
Run That Scripts Using CMakeLists. Model Loaded is success, but LGBM_BoosterPredictForMatSingleRow encounters segmentation fault.
@imatiach-msft
And @BuGTEa , could you provide the model file (model.txt)?
Here it is. The model.txt is generated by Python API.
model.txt
you should pass handle directly in LGBM_BoosterPredictForMatSingleRow, not its pointer.
Most helpful comment
you should pass
handledirectly inLGBM_BoosterPredictForMatSingleRow, not its pointer.