Skip to content

Commit

Permalink
Remove XGBoosterGetModelRaw. (#9617)
Browse files Browse the repository at this point in the history
Deprecated in 1.6.
  • Loading branch information
trivialfis committed Sep 28, 2023
1 parent d95be1c commit 4d7a187
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
9 changes: 0 additions & 9 deletions include/xgboost/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1258,15 +1258,6 @@ XGB_DLL int XGBoosterLoadModelFromBuffer(BoosterHandle handle,
XGB_DLL int XGBoosterSaveModelToBuffer(BoosterHandle handle, char const *config, bst_ulong *out_len,
char const **out_dptr);

/*!
* \brief Save booster to a buffer with in binary format.
*
* \deprecated since 1.6.0
* \see XGBoosterSaveModelToBuffer()
*/
XGB_DLL int XGBoosterGetModelRaw(BoosterHandle handle, bst_ulong *out_len,
const char **out_dptr);

/*!
* \brief Memory snapshot based serialization method. Saves everything states
* into buffer.
Expand Down
23 changes: 0 additions & 23 deletions src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1348,29 +1348,6 @@ XGB_DLL int XGBoosterSaveModelToBuffer(BoosterHandle handle, char const *json_co
API_END();
}

XGB_DLL int XGBoosterGetModelRaw(BoosterHandle handle, xgboost::bst_ulong *out_len,
const char **out_dptr) {
API_BEGIN();
CHECK_HANDLE();

auto *learner = static_cast<Learner*>(handle);
std::string& raw_str = learner->GetThreadLocal().ret_str;
raw_str.resize(0);

common::MemoryBufferStream fo(&raw_str);
LOG(WARNING) << error::DeprecatedFunc(__func__, "1.6.0", "XGBoosterSaveModelToBuffer");

learner->Configure();
learner->SaveModel(&fo);

xgboost_CHECK_C_ARG_PTR(out_dptr);
xgboost_CHECK_C_ARG_PTR(out_len);

*out_dptr = dmlc::BeginPtr(raw_str);
*out_len = static_cast<xgboost::bst_ulong>(raw_str.length());
API_END();
}

// The following two functions are `Load` and `Save` for memory based
// serialization methods. E.g. Python pickle.
XGB_DLL int XGBoosterSerializeToBuffer(BoosterHandle handle, xgboost::bst_ulong *out_len,
Expand Down

0 comments on commit 4d7a187

Please sign in to comment.