MaartenGr / MaartenGr/BERTopic
Google cloud session crashes when using cuML when clustering in fit
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
I am using cuML as the hdbscan for clustering using gpu as I have 1 million short docs and I need to run with calculate_probabilities=True to get topic distributions.
My code is as follows:
```python
from google.colab import userdata
from cuml.cluster import HDBSCAN
api_key = 'openai-key'
hdbscan_model = HDBSCAN(min_samples=10, gen_min_span_tree=True, prediction_data=True)
docs = df['body']
topic_modeler = TopicModel()
topics = topic_modeler.train_topic_model(docs,
embeddings=embeddings,
min_topic_size=5,
nr_topics = None,
calculate_probabilities=True,
hdbscan_model=hdbscan_model,
representation_model='openAI',
api_key=api_key,
save_path=MODEL_PATH,
save_file= 'topic_model_min_topics_5_no_dc_subset')`
```
I see the following messages:
```
2025-05-22 12:32:05,122 - BERTopic - Dimensionality - Fitting the dimensionality reduction algorithm
2025-05-22 12:38:00,201 - BERTopic - Dimensionality - Completed ✓
2025-05-22 12:38:00,211 - BERTopic - Cluster - Start clustering the reduced embeddings
```
But a couple of minutes after starting clustering the kernel crashes without any messages.
Please find attached the logs. Any help would be appreciated.
[cuml_error.log](https://github.com/user-attachments/files/20392354/cuml_error.log)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Python snippet and cuml_error.log, then reproduce the BERTopic clustering stage with cuML HDBSCAN and calculate_probabilities=True in the reported Google Colab environment. Determine whether the crash is in BERTopic integration or the cuML/GPU runtime; done means documenting a confirmed cause and a scoped fix or workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gcp, python
- Domain
- cloud, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100