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

[jvm-packages] add format option when saving a model #7940

Merged
merged 4 commits into from
May 30, 2022

Conversation

wbo4958
Copy link
Contributor

@wbo4958 wbo4958 commented May 25, 2022

This PR adds a format option which allows the booster to be dumped into json or ubj.

For now, we still use "deprecated" format as the default when dumping the booster model, but we're able to choose the different booster formats like json, ubj to be dumped.

eg,

model.write.option("format", "json").save(modelJsonPath)

or

model.write.option("format", "ubj").save(modelJsonPath)

@wbo4958 wbo4958 changed the title [jvm-packages] add format option when saving a model [skip ci] [jvm-packages] add format option when saving a model May 30, 2022
@wbo4958
Copy link
Contributor Author

wbo4958 commented May 30, 2022

@trivialfis please help to review it.

Copy link
Member

@trivialfis trivialfis left a comment

Choose a reason for hiding this comment

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

Thank you for the work on the file format. Could you please update the document: https://github.com/dmlc/xgboost/blob/master/doc/tutorials/saving_model.rst ?

@wbo4958
Copy link
Contributor Author

wbo4958 commented May 30, 2022

Yeah, I will add it in the followup PR. Thx

private[spark] abstract class XGBoostWriter extends MLWriter {

/** Currently it's using the "deprecated" format as
* default, which will be changed into `ubj` in future releases. */
Copy link
Member

Choose a reason for hiding this comment

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

changed into json in future releases.

@trivialfis trivialfis merged commit 6275cdc into dmlc:master May 30, 2022
@wbo4958 wbo4958 deleted the model-format branch May 31, 2022 01:19
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

Successfully merging this pull request may close these issues.

2 participants