|
28 | 28 | #include "xgboost/logging.h"
|
29 | 29 | #include "xgboost/objective.h"
|
30 | 30 | #include "xgboost/predictor.h"
|
| 31 | +#include "xgboost/string_view.h" |
31 | 32 | #include "xgboost/tree_updater.h"
|
32 | 33 |
|
33 | 34 | namespace xgboost {
|
@@ -395,23 +396,36 @@ void GBTree::LoadConfig(Json const& in) {
|
395 | 396 | tparam_.process_type = TreeProcessType::kDefault;
|
396 | 397 | int32_t const n_gpus = xgboost::common::AllVisibleGPUs();
|
397 | 398 | if (n_gpus == 0 && tparam_.predictor == PredictorType::kGPUPredictor) {
|
398 |
| - LOG(WARNING) |
399 |
| - << "Loading from a raw memory buffer on CPU only machine. " |
400 |
| - "Changing predictor to auto."; |
| 399 | + LOG(WARNING) << "Loading from a raw memory buffer on CPU only machine. " |
| 400 | + "Changing predictor to auto."; |
401 | 401 | tparam_.UpdateAllowUnknown(Args{{"predictor", "auto"}});
|
402 | 402 | }
|
| 403 | + |
| 404 | + auto msg = StringView{ |
| 405 | + R"( |
| 406 | + Loading from a raw memory buffer (like pickle in Python, RDS in R) on a CPU-only |
| 407 | + machine. Consider using `save_model/load_model` instead. See: |
| 408 | +
|
| 409 | + https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html |
| 410 | +
|
| 411 | + for more details about differences between saving model and serializing.)"}; |
| 412 | + |
403 | 413 | if (n_gpus == 0 && tparam_.tree_method == TreeMethod::kGPUHist) {
|
404 | 414 | tparam_.UpdateAllowUnknown(Args{{"tree_method", "hist"}});
|
405 |
| - LOG(WARNING) |
406 |
| - << "Loading from a raw memory buffer on CPU only machine. " |
407 |
| - "Changing tree_method to hist."; |
| 415 | + LOG(WARNING) << msg << " Changing `tree_method` to `hist`."; |
408 | 416 | }
|
409 | 417 |
|
410 | 418 | auto const& j_updaters = get<Object const>(in["updater"]);
|
411 | 419 | updaters_.clear();
|
| 420 | + |
412 | 421 | for (auto const& kv : j_updaters) {
|
413 |
| - std::unique_ptr<TreeUpdater> up( |
414 |
| - TreeUpdater::Create(kv.first, ctx_, model_.learner_model_param->task)); |
| 422 | + auto name = kv.first; |
| 423 | + if (n_gpus == 0 && name == "grow_gpu_hist") { |
| 424 | + name = "grow_quantile_histmaker"; |
| 425 | + LOG(WARNING) << "Changing updater from `grow_gpu_hist` to `grow_quantile_histmaker`."; |
| 426 | + } |
| 427 | + std::unique_ptr<TreeUpdater> up{ |
| 428 | + TreeUpdater::Create(name, ctx_, model_.learner_model_param->task)}; |
415 | 429 | up->LoadConfig(kv.second);
|
416 | 430 | updaters_.push_back(std::move(up));
|
417 | 431 | }
|
|
0 commit comments