Reduce symmetric search results for cross-encoder to re-rank to improve search speed

This commit is contained in:
debanjum 2021-11-16 11:31:19 -08:00
parent f3fd5ae978
commit 8c858d1a94

View file

@ -22,7 +22,7 @@ def initialize_model():
"Initialize model for symetric semantic search. That is, where query of similar size to results" "Initialize model for symetric semantic search. That is, where query of similar size to results"
torch.set_num_threads(4) torch.set_num_threads(4)
bi_encoder = SentenceTransformer('sentence-transformers/paraphrase-MiniLM-L6-v2') # The encoder encodes all entries to use for semantic search bi_encoder = SentenceTransformer('sentence-transformers/paraphrase-MiniLM-L6-v2') # The encoder encodes all entries to use for semantic search
top_k = 100 # Number of entries we want to retrieve with the bi-encoder top_k = 30 # Number of entries we want to retrieve with the bi-encoder
cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2') # The cross-encoder re-ranks the results to improve quality cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2') # The cross-encoder re-ranks the results to improve quality
return bi_encoder, cross_encoder, top_k return bi_encoder, cross_encoder, top_k