This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new e647684775 [MetaSchedule] Replace `xgboost.rabit` with
`xgboost.collective` because it's deprecated (#17166)
e647684775 is described below
commit e6476847753c80e054719ac47bc2091c888418b6
Author: Masahiro Hiramori <[email protected]>
AuthorDate: Tue Jul 23 21:39:48 2024 +0900
[MetaSchedule] Replace `xgboost.rabit` with `xgboost.collective` because
it's deprecated (#17166)
* use collective instead of rabit
* can work with xgb==1.4.2 in CI
---
python/tvm/meta_schedule/cost_model/xgb_model.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/python/tvm/meta_schedule/cost_model/xgb_model.py
b/python/tvm/meta_schedule/cost_model/xgb_model.py
index 6b6b7a2dc1..aaee58fc94 100644
--- a/python/tvm/meta_schedule/cost_model/xgb_model.py
+++ b/python/tvm/meta_schedule/cost_model/xgb_model.py
@@ -755,7 +755,12 @@ def _get_custom_call_back(
raise ValueError("wrong metric value", value)
import xgboost as xgb
- from xgboost import rabit # type: ignore
+
+ # make it compatible with xgboost<1.7
+ try:
+ from xgboost import rabit as collective # type: ignore
+ except ImportError:
+ from xgboost import collective # type: ignore
try:
from xgboost.training import aggcv # type: ignore
@@ -841,7 +846,7 @@ def _get_custom_call_back(
elif epoch - best_iteration >= self.early_stopping_rounds:
best_msg = self.state["best_msg"]
- if self.verbose_eval and rabit.get_rank() == 0:
+ if self.verbose_eval and collective.get_rank() == 0:
logger.debug("XGB stopped. Best iteration: %s ", best_msg)
# instead of raising EarlyStopException, returning True to end
the training
return True