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

lightgbm v3 model file not compatible with v4 #6082

Closed
Sammus187 opened this issue Sep 7, 2023 · 2 comments · Fixed by #6126
Closed

lightgbm v3 model file not compatible with v4 #6082

Sammus187 opened this issue Sep 7, 2023 · 2 comments · Fixed by #6126
Labels

Comments

@Sammus187
Copy link

Description

Model file fit and output with v3.3.0 can not be loaded in with v4.0.0.

Tested working using lightgbm v2.3.1 and v3.3.0.

Throws exception in v4.0.0. Tested in both Windows and Linux.

In Linux (Ubuntu 20.04):

  File "test.py", line 3, in <module>
    lgb.Booster(model_file='./test.txt')
  File "/opt/conda/lib/python3.8/site-packages/lightgbm/basic.py", line 3142, in __init__
    params = self._get_loaded_param()
  File "/opt/conda/lib/python3.8/site-packages/lightgbm/basic.py", line 3196, in _get_loaded_param
    _safe_call(_LIB.LGBM_BoosterGetLoadedParam(
  File "/opt/conda/lib/python3.8/site-packages/lightgbm/basic.py", line 237, in _safe_call
    raise LightGBMError(_LIB.LGBM_GetLastError().decode('utf-8'))
lightgbm.basic.LightGBMError: unordered_map::at

Windows gives a slightly different error (attached screencap - could not copy text from test environment)
b283e05b-048d-482c-b654-1592c4bbf15c

Reproducible example

Using attached test.txt

import lightgbm as lgb
lgb.Booster(model_file='./test.txt')

Environment info

python 3.8.6 and python 3.11.3
LightGBM version: 3.3.0 and 4.0.0

Command(s) you used to install LightGBM

pip install lightgbm==3.3.0 

and

pip install lightgbm==4.0.0

Additional Comments

@jameslamb jameslamb added the bug label Sep 7, 2023
@ryan-gunderson
Copy link

I am experiencing the same problem. Through trial and error, the parameters in the model file that was causing this problem for me are

[max_conflict_rate: 0]
[sparse_threshold: 0.8]
[max_position: 20]
[lambdamart_norm: 1]

I'm not sure if there are others. Removing them allows the model to be loaded but I have not verified that the loaded model behaves correctly.

Copy link

github-actions bot commented Oct 9, 2024

This issue 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:/microsoft/LightGBM/issues including a reference to this.

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

Successfully merging a pull request may close this issue.

3 participants