Skip to content

Commit be7098d

Browse files
Remove unused config parameter from V1 XGBoost training function
Bug identified by cursor bot: The _xgboost_train_fn_per_worker function had an unused 'config' parameter that was never utilized. This parameter was misleading because: 1. All XGBoost training parameters are in 'xgboost_train_kwargs' which is bound via functools.partial 2. V1 XGBoostTrainer doesn't use train_loop_config pattern 3. The config parameter served no purpose and made the code confusing Fix: Removed the config parameter and updated docstring to clarify this is an internal V1 function where all parameters are pre-bound via partial, unlike the V2 pattern where user functions receive train_loop_config. This makes the V1 trainer's implementation pattern clearer and removes confusion about parameter usage. Signed-off-by: soffer-anyscale <[email protected]>
1 parent 4b99c1e commit be7098d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

python/ray/train/xgboost/xgboost_trainer.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ def _configure_external_memory_params(config: dict):
264264

265265

266266
def _xgboost_train_fn_per_worker(
267-
config: dict,
268267
label_column: str,
269268
num_boost_round: int,
270269
dataset_keys: set,
@@ -281,17 +280,21 @@ def _xgboost_train_fn_per_worker(
281280
the configuration. It manages checkpointing, dataset iteration, and
282281
training progress tracking.
283282
283+
Note:
284+
This is an internal function used by the V1 XGBoostTrainer. All parameters
285+
are bound via functools.partial before being passed to the base trainer,
286+
unlike the V2 pattern where a user-defined function receives train_loop_config.
287+
284288
Args:
285-
config: XGBoost training configuration parameters. Should include
286-
tree_method, objective, and evaluation metrics.
287289
label_column: Name of the label column in the dataset. Must exist
288290
in all datasets.
289291
num_boost_round: Target number of boosting rounds for training.
290292
When resuming from checkpoint, trains for remaining rounds.
291293
dataset_keys: Set of dataset names available for training. Should
292294
include at least TRAIN_DATASET_KEY.
293-
xgboost_train_kwargs: Additional XGBoost training arguments such as
294-
callbacks, verbose settings, etc.
295+
xgboost_train_kwargs: XGBoost training parameters dictionary containing
296+
tree_method, objective, eval_metric, and other XGBoost parameters.
297+
This is passed directly to xgb.train().
295298
use_external_memory: Whether to use external memory for DMatrix creation.
296299
Required for large datasets that don't fit in RAM.
297300
external_memory_cache_dir: Directory for caching external memory files.

0 commit comments

Comments
 (0)