Skip to content

Commit

Permalink
Fix failing xgboost test in the cudf.pandas third-party integration t…
Browse files Browse the repository at this point in the history
…ests (#17616)

A part of #17490

Authors:
  - Matthew Murray (https://github.com/Matt711)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #17616
  • Loading branch information
Matt711 authored Dec 20, 2024
1 parent d8f469f commit 6cd1513
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ def test_with_external_memory(
return predt


@pytest.mark.skip(
reason="TypeError: Implicit conversion to a NumPy array is not allowed. Please use `.get()` to construct a NumPy array explicitly."
)
@pytest.mark.parametrize("device", ["cpu", "cuda"])
def test_predict(device: str) -> np.ndarray:
reg = xgb.XGBRegressor(n_estimators=2, device=device)
Expand All @@ -127,6 +124,11 @@ def test_predict(device: str) -> np.ndarray:
predt0 = reg.predict(X_df)

predt1 = booster.inplace_predict(X_df)
# After https://github.com/dmlc/xgboost/pull/11014, .inplace_predict()
# returns a real cupy array when called on a cudf.pandas proxy dataframe.
# So we need to ensure we have a valid numpy array.
if not isinstance(predt1, np.ndarray):
predt1 = predt1.get()
np.testing.assert_allclose(predt0, predt1)

predt2 = booster.predict(xgb.DMatrix(X_df))
Expand Down

0 comments on commit 6cd1513

Please sign in to comment.