Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions python/tvm/meta_schedule/cost_model/xgb_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,12 @@ def _fmt_metric(value, show_stdv=True):
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
Expand Down Expand Up @@ -841,7 +846,7 @@ def _fmt_metric(value, show_stdv=True):
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
Expand Down