huzey commited on
Commit
db6540f
1 Parent(s): 04649b1

update gpu

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -555,7 +555,7 @@ def compute_ncut(
555
  affinity_focal_gamma=affinity_focal_gamma,
556
  knn=knn_ncut,
557
  ).fit_transform(features.reshape(-1, features.shape[-1]))
558
- print(f"NCUT time (cpu): {time.time() - start:.2f}s")
559
 
560
  start = time.time()
561
  if embedding_method == "UMAP":
@@ -564,7 +564,7 @@ def compute_ncut(
564
  n_neighbors=n_neighbors,
565
  min_dist=min_dist,
566
  )
567
- print(f"UMAP time (cpu): {time.time() - start:.2f}s")
568
  elif embedding_method == "t-SNE":
569
  X_3d, rgb = rgb_from_tsne_3d(
570
  eigvecs,
@@ -572,7 +572,7 @@ def compute_ncut(
572
  perplexity=perplexity,
573
  knn=knn_tsne,
574
  )
575
- print(f"t-SNE time (cpu): {time.time() - start:.2f}s")
576
  else:
577
  raise ValueError(f"Embedding method {embedding_method} not supported.")
578
 
@@ -657,7 +657,7 @@ demo = gr.Interface(
657
  additional_inputs=[
658
  gr.Dropdown(["attn", "mlp", "block"], label="Node type", value="block", elem_id="node_type", info="attn: attention output, mlp: mlp output, block: sum of residual stream"),
659
  gr.Slider(0.01, 1, step=0.01, label="Affinity focal gamma", value=0.3, elem_id="affinity_focal_gamma", info="decrease for more aggressive cleaning on the affinity matrix"),
660
- gr.Slider(100, 10000, step=100, label="num_sample (NCUT)", value=5000, elem_id="num_sample_ncut", info="for Nyström approximation"),
661
  gr.Slider(1, 100, step=1, label="KNN (NCUT)", value=10, elem_id="knn_ncut", info="for Nyström approximation"),
662
  gr.Dropdown(["t-SNE", "UMAP"], label="Embedding method", value="t-SNE", elem_id="embedding_method"),
663
  gr.Slider(100, 1000, step=100, label="num_sample (t-SNE/UMAP)", value=300, elem_id="num_sample_tsne", info="for Nyström approximation. Adding will slow down quite a lot"),
 
555
  affinity_focal_gamma=affinity_focal_gamma,
556
  knn=knn_ncut,
557
  ).fit_transform(features.reshape(-1, features.shape[-1]))
558
+ print(f"NCUT time: {time.time() - start:.2f}s")
559
 
560
  start = time.time()
561
  if embedding_method == "UMAP":
 
564
  n_neighbors=n_neighbors,
565
  min_dist=min_dist,
566
  )
567
+ print(f"UMAP time: {time.time() - start:.2f}s")
568
  elif embedding_method == "t-SNE":
569
  X_3d, rgb = rgb_from_tsne_3d(
570
  eigvecs,
 
572
  perplexity=perplexity,
573
  knn=knn_tsne,
574
  )
575
+ print(f"t-SNE time: {time.time() - start:.2f}s")
576
  else:
577
  raise ValueError(f"Embedding method {embedding_method} not supported.")
578
 
 
657
  additional_inputs=[
658
  gr.Dropdown(["attn", "mlp", "block"], label="Node type", value="block", elem_id="node_type", info="attn: attention output, mlp: mlp output, block: sum of residual stream"),
659
  gr.Slider(0.01, 1, step=0.01, label="Affinity focal gamma", value=0.3, elem_id="affinity_focal_gamma", info="decrease for more aggressive cleaning on the affinity matrix"),
660
+ gr.Slider(100, 50000, step=100, label="num_sample (NCUT)", value=25000, elem_id="num_sample_ncut", info="for Nyström approximation"),
661
  gr.Slider(1, 100, step=1, label="KNN (NCUT)", value=10, elem_id="knn_ncut", info="for Nyström approximation"),
662
  gr.Dropdown(["t-SNE", "UMAP"], label="Embedding method", value="t-SNE", elem_id="embedding_method"),
663
  gr.Slider(100, 1000, step=100, label="num_sample (t-SNE/UMAP)", value=300, elem_id="num_sample_tsne", info="for Nyström approximation. Adding will slow down quite a lot"),