From 1496789561f300fac83f3f18d823c1504cf8b087 Mon Sep 17 00:00:00 2001 From: Bobby Wang Date: Mon, 16 May 2022 14:05:26 +0800 Subject: [PATCH] [doc] update the doc for jvm model compatibility (#7907) --- doc/jvm/xgboost4j_spark_tutorial.rst | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/jvm/xgboost4j_spark_tutorial.rst b/doc/jvm/xgboost4j_spark_tutorial.rst index 33145ac23..dbfc6d765 100644 --- a/doc/jvm/xgboost4j_spark_tutorial.rst +++ b/doc/jvm/xgboost4j_spark_tutorial.rst @@ -349,7 +349,23 @@ With regards to ML pipeline save and load, please refer the next section. Interact with Other Bindings of XGBoost --------------------------------------- -After we train a model with XGBoost4j-Spark on massive dataset, sometimes we want to do model serving in single machine or integrate it with other single node libraries for further processing. XGBoost4j-Spark supports export model to local by: +After we train a model with XGBoost4j-Spark on massive dataset, sometimes we want to do model serving +in single machine or integrate it with other single node libraries for further processing. + +After saving the model, we can load this model with single node Python XGBoost directly from ``version 2.0.0+``. + +.. code-block:: scala + + val xgbClassificationModelPath = "/tmp/xgbClassificationModel" + xgbClassificationModel.write.overwrite().save(xgbClassificationModelPath) + +.. code-block:: python + + import xgboost as xgb + bst = xgb.Booster({'nthread': 4}) + bst.load_model("/tmp/xgbClassificationModel/data/XGBoostClassificationModel") + +Before ``version 2.0.0``, XGBoost4j-Spark needs to export model to local manually by: .. code-block:: scala