From 2140295510eaa42880cb613272b553da9a8b6f60 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Thu, 4 Jan 2024 01:02:15 +0800 Subject: [PATCH] Save model in ubj as the default. --- src/c_api/c_api.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/c_api/c_api.cc b/src/c_api/c_api.cc index 9aedcef2e855..9916a881a22d 100644 --- a/src/c_api/c_api.cc +++ b/src/c_api/c_api.cc @@ -1339,14 +1339,14 @@ XGB_DLL int XGBoosterSaveModel(BoosterHandle handle, const char *fname) { save_json(std::ios::out); } else if (common::FileExtension(fname) == "ubj") { save_json(std::ios::binary); - } else if (XGBOOST_VER_MAJOR == 2 && XGBOOST_VER_MINOR >= 2) { - LOG(WARNING) << "Saving model to JSON as default. You can use file extension `json`, `ubj` or " - "`deprecated` to choose between formats."; - save_json(std::ios::out); - } else { + } else if (common::FileExtension(fname) == "deprecated") { WarnOldModel(); auto *bst = static_cast(handle); bst->SaveModel(fo.get()); + } else { + LOG(WARNING) << "Saving model in the UBJSON format as default. You can use file extension:" + " `json`, `ubj` or `deprecated` to choose between formats."; + save_json(std::ios::binary); } API_END(); }