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

Avoid segment fault in ResetConfig for GBDT in prediction (fix #3317) #3373

Merged
merged 1 commit into from
Sep 11, 2020

Conversation

shiyu1994
Copy link
Collaborator

This PR is to fix #3317. When a booster is created from model file, its config_ member will be undefined. However, the ResetConfig method of GBDT is not aware of this. As @glarb pointed out.

@StrikerRUS StrikerRUS added the fix label Sep 9, 2020
@guolinke guolinke merged commit fee6f4a into microsoft:master Sep 11, 2020
@@ -718,7 +719,7 @@ void GBDT::ResetConfig(const Config* config) {
if (train_data_ != nullptr) {
ResetBaggingConfig(new_config.get(), false);
}
if (config_->forcedsplits_filename != new_config->forcedbins_filename) {
if (config_.get() != nullptr && config_->forcedsplits_filename != new_config->forcedbins_filename) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guolinke I think there might be a typo here, should it be new_config->forcedsplits_filename (instead of new_config->forcedbins_filename)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@btrotta you are right, it is typo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@btrotta can you help to create a PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guolinke Done in #3392.

@shiyu1994 Apologies, I just now realized you are the author of this PR, not guolinke. I should have mentioned you in my original comment.

@btrotta btrotta mentioned this pull request Sep 13, 2020
@glarb
Copy link

glarb commented Sep 22, 2020

Hi @shiyu1994, I think it would have been better for LGBM_BoosterResetParameter() to just create the config if it doesn't exist. That way folks can set parameters once instead of for each predict (like we could before). Please reconsider this fix, thanks.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

segfault in LGBM_BoosterResetParameter()
5 participants