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

Easiest way to get version info of a XGBoost model through C++ interface #8435

Closed
yunmengxie opened this issue Nov 7, 2022 · 3 comments
Closed

Comments

@yunmengxie
Copy link

Hi there, I have a question regarding retrieve the version info of a XGBoost model.

Say that I have a pre-trained XGBoost model saved in bst/json format, what would be the easiest way to get the XGBoost library version that trained this model?

I checked through api methods in C++ interface, looks like these isn't an existing api to get the version info, any recommendation to achieve this?

@trivialfis
Copy link
Member

trivialfis commented Nov 8, 2022

Hi, the version recorded by XGBoost is the last version that saved the model, instead of the version that trained the model. Meaning, if you train a model with XGBoost 1.5, load the model and save it again using 1.7, then the recorded version will be changed to 1.7.

Now that this is clear, you can see the version in the output JSON file.

@yunmengxie
Copy link
Author

Thanks for the answer! What if the model is trained with XGBoost 1.5 and saved in bst(instead of json) format, how could I tell this model is trained with 1.5 when loading it using 1.7?

@trivialfis
Copy link
Member

trivialfis commented Nov 8, 2022

There's no easy way to do that with the old binary format. One of the reasons for #7547 .

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