From b57840f982c781989f57ea989ee5044d07b399b6 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Wed, 22 Jan 2025 03:07:15 +0800 Subject: [PATCH] [dask] Remove dconcat. (#11178) --- python-package/xgboost/core.py | 4 +--- python-package/xgboost/dask/data.py | 12 ++---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index f72fe0945979..fdfc7d3d6be6 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -508,9 +508,7 @@ def __init__( def get_callbacks(self, enable_categorical: bool) -> Tuple[Callable, Callable]: """Get callback functions for iterating in C. This is an internal function.""" assert hasattr(self, "cache_prefix"), "__init__ is not called." - reset_callback = ctypes.CFUNCTYPE(None, ctypes.c_void_p)( - self._reset_wrapper - ) + reset_callback = ctypes.CFUNCTYPE(None, ctypes.c_void_p)(self._reset_wrapper) next_callback = ctypes.CFUNCTYPE( ctypes.c_int, ctypes.c_void_p, diff --git a/python-package/xgboost/dask/data.py b/python-package/xgboost/dask/data.py index cff853748ae8..2a80874e9821 100644 --- a/python-package/xgboost/dask/data.py +++ b/python-package/xgboost/dask/data.py @@ -23,7 +23,7 @@ from dask import dataframe as dd from .. import collective as coll -from .._typing import _T, FeatureNames +from .._typing import FeatureNames from ..compat import concat, import_cupy from ..core import DataIter, DMatrix, QuantileDMatrix from ..data import is_on_cuda @@ -33,14 +33,6 @@ _DataParts = List[Dict[str, Any]] -def dconcat(value: Sequence[_T]) -> _T: - """Concatenate sequence of partitions.""" - try: - return concat(value) - except TypeError: - return dd.multi.concat(list(value), axis=0) - - meta = [ "label", "weight", @@ -383,7 +375,7 @@ def _create_dmatrix( # pylint: disable=too-many-locals def concat_or_none(data: Sequence[Optional[T]]) -> Optional[T]: if any(part is None for part in data): return None - return dconcat(data) + return concat(data) unzipped_dict = _get_worker_parts(list_of_parts) concated_dict: Dict[str, Any] = {}