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

errror:'Booster' object has no attribute 'attr' #645

Open
shushan2017 opened this issue Aug 18, 2023 · 5 comments
Open

errror:'Booster' object has no attribute 'attr' #645

shushan2017 opened this issue Aug 18, 2023 · 5 comments

Comments

@shushan2017
Copy link

model_path = 'c://model/m18.m1'
lgb_model = lgb.Booster(model_file=model_path)

input_type = FloatTensorType([1, 154])

onnx_model = onnxmltools.convert_lightgbm(lgb_model, initial_types=[('input', input_type)],
target_opset=9)
Traceback (most recent call last):

Cell In[4], line 1
onnx_model = onnxmltools.convert_lightgbm(lgb_model, initial_types=[('input', input_type)],

File C:\anaconda3\Lib\site-packages\onnxmltools\convert\main.py:137 in convert_lightgbm
return convert(model, name, initial_types, doc_string, target_opset, targeted_onnx,

File C:\anaconda3\Lib\site-packages\onnxmltools\convert\lightgbm\convert.py:59 in convert
model = WrappedBooster(model)

File C:\anaconda3\Lib\site-packages\onnxmltools\convert\lightgbm_parse.py:25 in init
self.objective_ = self.get_objective()

File C:\anaconda3\Lib\site-packages\onnxmltools\convert\lightgbm_parse.py:62 in get_objective
objective = self.booster_.attr('objective')

AttributeError: 'Booster' object has no attribute 'attr'

//*****************************
python=3.11
lithtgbm=4.0.0
onnxmltools=1.11.2

@siran1996
Copy link

siran1996 commented Sep 6, 2023

I have the issue, any updates?

@morgand-hastings
Copy link

I have this issue also, any updates?

@XMoyas
Copy link

XMoyas commented Nov 3, 2023

any updates? or any other solutions?

@morgand-hastings
Copy link

Force downgrade of LightGBM to < v4.0 solved this for me:

pip install --force-reinstall -v "lightgbm==3.3.5"

@shushan2017
Copy link
Author

强制将 LightGBM 降级到 < v4.0 为我解决了这个问题:

pip install --force-reinstall -v "lightgbm==3.3.5"

t hank you!!!!!

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

4 participants