asoria HF staff commited on
Commit
e65c78c
1 Parent(s): 253352b

Enabling umap and hdbscan without GPU because of ZeroGPU

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +17 -2
  3. requirements.txt +0 -2
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ venv/
app.py CHANGED
@@ -23,8 +23,12 @@ from gradio_huggingfacehub_search import HuggingfaceHubSearch
23
  from bertopic import BERTopic
24
  from bertopic.representation import KeyBERTInspired
25
  from bertopic.representation import TextGeneration
26
- from cuml.manifold import UMAP
27
- from cuml.cluster import HDBSCAN
 
 
 
 
28
  from huggingface_hub import HfApi
29
  from sklearn.feature_extraction.text import CountVectorizer
30
  from sentence_transformers import SentenceTransformer
@@ -336,6 +340,17 @@ def generate_topics(dataset, config, split, column, nested_column, plot_type):
336
  plot_png_link = (
337
  f"https://huggingface.co/datasets/{EXPORTS_REPOSITORY}/blob/main/{plot_png}"
338
  )
 
 
 
 
 
 
 
 
 
 
 
339
  yield (
340
  gr.Accordion(open=False),
341
  topics_info,
 
23
  from bertopic import BERTopic
24
  from bertopic.representation import KeyBERTInspired
25
  from bertopic.representation import TextGeneration
26
+
27
+ # Temporary disabling because of ZeroGPU does not support cuml
28
+ # from cuml.manifold import UMAP
29
+ # from cuml.cluster import HDBSCAN
30
+ from umap import UMAP
31
+ from hdbscan import HDBSCAN
32
  from huggingface_hub import HfApi
33
  from sklearn.feature_extraction.text import CountVectorizer
34
  from sentence_transformers import SentenceTransformer
 
340
  plot_png_link = (
341
  f"https://huggingface.co/datasets/{EXPORTS_REPOSITORY}/blob/main/{plot_png}"
342
  )
343
+ # interactive_plot = datamapplot.create_interactive_plot(
344
+ # reduced_embeddings_array,
345
+ # *cord19_label_layers,
346
+ # font_family="Cinzel",
347
+ # enable_search=True,
348
+ # inline_data=False,
349
+ # offline_data_prefix="cord-large-1",
350
+ # initial_zoom_fraction=0.4,
351
+ # )
352
+ # all_topics, _ = base_model.transform(all_topics)
353
+ # logging.info(f"TAll opics: {all_topics[:5]}")
354
  yield (
355
  gr.Accordion(open=False),
356
  topics_info,
requirements.txt CHANGED
@@ -14,5 +14,3 @@ numpy
14
  python-dotenv
15
  kaleido
16
  transformers
17
- --extra-index-url https://pypi.nvidia.com
18
- cuml-cu12
 
14
  python-dotenv
15
  kaleido
16
  transformers