Ensure top_k never more than total entries to run symmetric search on

This commit is contained in:
debanjum 2021-11-16 11:32:21 -08:00
parent 8c858d1a94
commit 46661b3057

View file

@ -153,6 +153,7 @@ def setup(config: TextSearchConfig, regenerate: bool) -> TextSearchModel:
# Extract Entries
entries = extract_entries(config.compressed_jsonl, config.verbose)
top_k = min(len(entries), top_k)
# Compute or Load Embeddings
corpus_embeddings = compute_embeddings(entries, bi_encoder, config.embeddings_file, regenerate=regenerate, verbose=config.verbose)