[dask] Fix ddqdm with empty partition. (#7510)
* Fix empty partition. * war.
This commit is contained in:
@@ -1071,7 +1071,7 @@ class DMatrix: # pylint: disable=too-many-instance-attributes
|
||||
c_feature_types,
|
||||
c_bst_ulong(len(feature_types))))
|
||||
|
||||
if len(feature_types) != self.num_col():
|
||||
if len(feature_types) != self.num_col() and self.num_col() != 0:
|
||||
msg = 'feature_types must have the same length as data'
|
||||
raise ValueError(msg)
|
||||
else:
|
||||
|
||||
@@ -1015,6 +1015,8 @@ def _maybe_dataframe(
|
||||
index = getattr(data, "index", None)
|
||||
if lazy_isinstance(data, "cudf.core.dataframe", "DataFrame"):
|
||||
import cudf
|
||||
if prediction.size == 0:
|
||||
return cudf.DataFrame({}, columns=columns, dtype=numpy.float32)
|
||||
|
||||
prediction = cudf.DataFrame(
|
||||
prediction, columns=columns, dtype=numpy.float32, index=index
|
||||
|
||||
Reference in New Issue
Block a user