LightGBM: LightGBMError: Tree model should contain num_cat field (version incompatibility issue)

Hello all,

Some of my models have been created and saved in LightGBM version 2.0.1. When model.predict(x) called on these models, recent LightGBM returns the error: Tree model should contain num_cat field

I suspect something changed in model format since a while. Please advise how to convert old models to new format.

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

@alexander-rakhlin please remove the has_categorical=0

you can try to replace the decision_type=0 0 0 ... to decision_type=2 2 2 ...

you can rollback to version v2.0.1, and then load that model from pickle, and save to text format. Then do that to the model file.

you can add ‘num_cat=0’ for all trees, in the model file.