darpanaswal commited on
Commit
a0e2313
·
verified ·
1 Parent(s): f5d714a

Update cross_encoder_reranking_train.py

Browse files
Files changed (1) hide show
  1. cross_encoder_reranking_train.py +2 -2
cross_encoder_reranking_train.py CHANGED
@@ -29,8 +29,8 @@ def rank_by_centrality(texts):
29
  return [text for text, _ in ranked]
30
 
31
  def cluster_and_rank(texts, threshold=0.75):
32
- if len(texts) <= 3:
33
- return texts # Nothing to reduce
34
 
35
  embeddings = embed_text_list(texts)
36
  clustering = AgglomerativeClustering(n_clusters=None, distance_threshold=1-threshold, metric = "cosine", linkage='average')
 
29
  return [text for text, _ in ranked]
30
 
31
  def cluster_and_rank(texts, threshold=0.75):
32
+ if len(texts) < 2:
33
+ return texts
34
 
35
  embeddings = embed_text_list(texts)
36
  clustering = AgglomerativeClustering(n_clusters=None, distance_threshold=1-threshold, metric = "cosine", linkage='average')