6#ifndef XGBOOST_COMMON_ERROR_MSG_H_
7#define XGBOOST_COMMON_ERROR_MSG_H_
16#include "xgboost/string_view.h"
19constexpr StringView GroupWeight() {
20 return "Size of weight must equal to the number of query groups when ranking group is used.";
23constexpr StringView GroupSize() {
24 return "Invalid query group structure. The number of rows obtained from group doesn't equal to ";
27constexpr StringView LabelScoreSize() {
28 return "The size of label doesn't match the size of prediction.";
31constexpr StringView InfInData() {
32 return "Input data contains `inf` or a value too large, while `missing` is not set to `inf`";
35constexpr StringView NoF128() {
36 return "128-bit floating point is not supported on current platform.";
39constexpr StringView InconsistentMaxBin() {
40 return "Inconsistent `max_bin`. `max_bin` should be the same across different QuantileDMatrix, "
41 "and consistent with the Booster being trained.";
44constexpr StringView UnknownDevice() {
return "Unknown device type."; }
46inline void MaxFeatureSize(std::uint64_t n_features) {
47 auto max_n_features = std::numeric_limits<bst_feature_t>::max();
48 CHECK_LE(n_features, max_n_features)
49 <<
"Unfortunately, XGBoost does not support data matrices with "
50 << std::numeric_limits<bst_feature_t>::max() <<
" features or greater";
53constexpr StringView InplacePredictProxy() {
54 return "Inplace predict accepts only DMatrixProxy as input.";
57inline void MaxSampleSize(std::size_t n) {
58 LOG(FATAL) <<
"Sample size too large for the current updater. Maximum number of samples:" << n
59 <<
". Consider using a different updater or tree_method.";
62constexpr StringView OldSerialization() {
63 return R
"doc(If you are loading a serialized model (like pickle in Python, RDS in R) or
64configuration generated by an older version of XGBoost, please export the model by calling
65`Booster.save_model` from that version first, then load it back in current version. See:
67 https://xgboost.readthedocs.io/en/stable/tutorials/saving_model.html
69for more details about differences between saving model and serializing.
73inline void WarnOldSerialization() {
76 static thread_local bool logged{
false};
80 LOG(WARNING) << OldSerialization();
84void WarnDeprecatedGPUHist();
86void WarnManualUpdater();
88void WarnDeprecatedGPUId();
90void WarnEmptyDataset();
92std::string DeprecatedFunc(StringView old, StringView since, StringView replacement);
94constexpr StringView InvalidCUDAOrdinal() {
95 return "Invalid device. `device` is required to be CUDA and there must be at least one GPU "
96 "available for using GPU.";
99void MismatchedDevices(Context
const* booster, Context
const* data);
Copyright 2014-2023, XGBoost Contributors.
Copyright 2015-2023 by XGBoost Contributors.
defines console logging options for xgboost. Use to enforce unified print behavior.
Copyright 2023 by XGBoost contributors.
Definition error_msg.cc:13