Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip sparse vector tests for spark < 3.4 #779

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion python/src/spark_rapids_ml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def _train_udf(pdf_iter: Iterator[pd.DataFrame]) -> pd.DataFrame:
if concated_nnz > np.iinfo(np.int32).max:
logger.warn(
f"The number of non-zero values of a partition exceeds the int32 index dtype. \
cupyx csr_matrix currently does not promote the dtype to int64 when concatenated; \
cupyx csr_matrix currently does not support int64 indices (https://github.com/cupy/cupy/issues/3513); \
keeping as scipy csr_matrix to avoid overflow."
)
else:
Expand Down
2 changes: 1 addition & 1 deletion python/src/spark_rapids_ml/umap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ def _train_udf(pdf_iter: Iterable[pd.DataFrame]) -> Iterable[pd.DataFrame]:
if concated_nnz > np.iinfo(np.int32).max:
logger.warn(
f"The number of non-zero values of a partition exceeds the int32 index dtype. \
cupyx csr_matrix currently does not promote the dtype to int64 when concatenated; \
cupyx csr_matrix currently does not support int64 indices (https://github.com/cupy/cupy/issues/3513); \
keeping as scipy csr_matrix to avoid overflow."
)
else:
Expand Down
21 changes: 21 additions & 0 deletions python/tests/test_umap.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,24 @@ def test_params(tmp_path: str, default_params: bool) -> None:
def test_umap_model_persistence(
sparse_fit: bool, gpu_number: int, tmp_path: str
) -> None:
import pyspark
from cuml.datasets import make_blobs
from packaging import version

with CleanSparkSession() as spark:

n_rows = 5000
n_cols = 200

if sparse_fit:
if version.parse(pyspark.__version__) < version.parse("3.4.0"):
import logging

err_msg = "pyspark < 3.4 is detected. Cannot import pyspark `unwrap_udt` function for SparseVector. "
"The test case will be skipped. Please install pyspark>=3.4."
logging.info(err_msg)
return

data, input_raw_data = _load_sparse_binary_data(n_rows, n_cols, 30)
df = spark.createDataFrame(data, ["features"])
else:
Expand Down Expand Up @@ -429,6 +439,17 @@ def test_umap_chunking(
)

if sparse_fit:
import pyspark
from packaging import version

if version.parse(pyspark.__version__) < version.parse("3.4.0"):
import logging

err_msg = "pyspark < 3.4 is detected. Cannot import pyspark `unwrap_udt` function for SparseVector. "
"The test case will be skipped. Please install pyspark>=3.4."
logging.info(err_msg)
return

data, input_raw_data = _load_sparse_binary_data(n_rows, n_cols, 30)
df = spark.createDataFrame(data, ["features"])
nbytes = input_raw_data.data.nbytes
Expand Down