From add57f88800093cac76edf89c505d72cb2007947 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Tue, 29 Aug 2023 18:25:59 +0800 Subject: [PATCH] [backport] Delay the check for vector leaf. (#9509) (#9533) --- src/gbm/gbtree.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gbm/gbtree.cc b/src/gbm/gbtree.cc index e3df3862915c..92154609ce32 100644 --- a/src/gbm/gbtree.cc +++ b/src/gbm/gbtree.cc @@ -146,14 +146,6 @@ void GBTree::Configure(Args const& cfg) { if (specified_updater_) { error::WarnManualUpdater(); } - - if (model_.learner_model_param->IsVectorLeaf()) { - CHECK(tparam_.tree_method == TreeMethod::kHist || tparam_.tree_method == TreeMethod::kAuto) - << "Only the hist tree method is supported for building multi-target trees with vector " - "leaf."; - CHECK(ctx_->IsCPU()) << "GPU is not yet supported for vector leaf."; - } - LOG(DEBUG) << "Using tree method: " << static_cast(tparam_.tree_method); if (!specified_updater_) { @@ -225,6 +217,13 @@ void GBTree::UpdateTreeLeaf(DMatrix const* p_fmat, HostDeviceVector const void GBTree::DoBoost(DMatrix* p_fmat, HostDeviceVector* in_gpair, PredictionCacheEntry* predt, ObjFunction const* obj) { + if (model_.learner_model_param->IsVectorLeaf()) { + CHECK(tparam_.tree_method == TreeMethod::kHist || tparam_.tree_method == TreeMethod::kAuto) + << "Only the hist tree method is supported for building multi-target trees with vector " + "leaf."; + CHECK(ctx_->IsCPU()) << "GPU is not yet supported for vector leaf."; + } + TreesOneIter new_trees; bst_target_t const n_groups = model_.learner_model_param->OutputLength(); monitor_.Start("BoostNewTrees");