forked from rapidsai/cuml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_wheel_integrations.sh
More file actions
executable file
·79 lines (62 loc) · 2.39 KB
/
Copy pathtest_wheel_integrations.sh
File metadata and controls
executable file
·79 lines (62 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
source rapids-init-pip
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")"
CUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-package-name "wheel_python" cuml --stable --cuda "$RAPIDS_CUDA_VERSION")")
LIBCUML_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="libcuml_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-github cpp)
RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"}
mkdir -p "${RAPIDS_TESTS_DIR}"
EXITCODE=0
trap "EXITCODE=1" ERR
set +e
#
# BERTopic Integration Test
#
rapids-logger "===== Testing BERTopic Integration ====="
# Step 1: Install cuML wheels first (two-step workaround for issue #7374)
rapids-logger "Installing cuML wheels"
rapids-pip-retry install \
"${LIBCUML_WHEELHOUSE}"/libcuml*.whl \
"${CUML_WHEELHOUSE}"/cuml*.whl
# Step 2: Install BERTopic
rapids-logger "Installing BERTopic"
rapids-pip-retry install bertopic
rapids-pip-retry install requests # TODO remove once sentence-transformers#3617 is fixed
# Test 1: Verify imports
rapids-logger "Testing imports"
python -c "
import cuml
import bertopic
print('✓ Import test passed')
"
# Test 2: Run minimal end-to-end example
rapids-logger "Running BERTopic end-to-end smoke test"
timeout 20m python -c "
import warnings
warnings.filterwarnings('ignore')
import random
from bertopic import BERTopic
# Generate synthetic documents with topic-like word clusters
random.seed(42)
topics = [
['star', 'galaxy', 'planet', 'orbit', 'telescope', 'nasa', 'astronaut'],
['rocket', 'launch', 'satellite', 'mission', 'space', 'shuttle', 'station'],
['moon', 'mars', 'jupiter', 'asteroid', 'comet', 'meteor', 'crater'],
]
docs = []
for i in range(100):
topic_words = topics[i % len(topics)]
doc = ' '.join(random.choices(topic_words, k=random.randint(10, 30)))
docs.append(doc)
# Initialize BERTopic with cuML UMAP backend
# BERTopic will automatically use cuML's UMAP if available
topic_model = BERTopic(verbose=False, calculate_probabilities=False)
# Fit the model
topics, probs = topic_model.fit_transform(docs)
print(f'✓ BERTopic smoke test passed - processed {len(docs)} documents, found {len(set(topics))} topics')
"
rapids-logger "===== BERTopic Integration Test Complete ====="
rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}