Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault on text model prediction #1728

Closed
fminkin opened this issue Jun 1, 2021 · 0 comments
Closed

Segmentation Fault on text model prediction #1728

fminkin opened this issue Jun 1, 2021 · 0 comments

Comments

@fminkin
Copy link

fminkin commented Jun 1, 2021

Problem:
C++ imported text features only multiclass model fails to predict. Segmentation Fault.
In python everything works fine.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff795ca7c in CalcModelPredictionText () from /opt/cb/lib/libcatboostmodel.so.1

Float features-only models work fine with 0.25.1
catboost version: 0.25.1
Operating System: ubuntu 18.04
CPU: Intel(R) Xeon(R) Platinum 8168 CPU
Model to reproduce: https://disk.yandex.ru/d/8OAtaFE0X0NpwA

C++ code:

const int kClassCount = 3;
std::string text = "а почему пятьсот рублей";
std::string model_path = "c.cbm";
auto model_handle = ModelCalcerCreate();
if (!LoadFullModelFromFile(model_handle, model_path.c_str())) {
  std::abort();
}

std::vector<const char*> text_features_ptrs({text.c_str()});
const char** text_features_ptr = text_features_ptrs.data();
std::vector<double> result(kClassCount);
if (!CalcModelPredictionText(
    model_handle, 1,
    nullptr, 0, // float features
    nullptr, 0, // cat features
    &text_features_ptr, 1, // text features
    result.data(), kClassCount
   )) {
  throw std::runtime_error(GetErrorString());
}
arcadia-devtools pushed a commit that referenced this issue Jun 4, 2021
…o features

ref:42ba29da3b1da1e8f88efc52895495853d02be62
@kizill kizill closed this as completed Jun 4, 2021
robot-piglet pushed a commit that referenced this issue Jan 15, 2023
…o features

ref:42ba29da3b1da1e8f88efc52895495853d02be62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants