Skip to content

Commit

Permalink
Fix #1670
Browse files Browse the repository at this point in the history
  • Loading branch information
nreimers committed Aug 15, 2022
1 parent 07fd196 commit d8982c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sentence_transformers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def community_detection(embeddings, threshold=0.75, min_community_size=10, batch
top_val_large, top_idx_large = cos_scores[i].topk(k=sort_max_size, largest=True)

# Check if we need to increase sort_max_size
while top_val_large[-1] > threshold:
while top_val_large[-1] > threshold and sort_max_size < len(embeddings):
sort_max_size = min(2 * sort_max_size, len(embeddings))
top_val_large, top_idx_large = cos_scores[i].topk(k=sort_max_size, largest=True)

Expand Down

0 comments on commit d8982c9

Please sign in to comment.