mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Do not default to rerank if device has GPU
This commit is contained in:
parent
f1120f24a1
commit
632f55a9e8
1 changed files with 4 additions and 6 deletions
|
@ -177,13 +177,11 @@ def deduplicated_search_responses(hits: List[SearchResponse]):
|
||||||
|
|
||||||
|
|
||||||
def rerank_and_sort_results(hits, query, rank_results, search_model_name):
|
def rerank_and_sort_results(hits, query, rank_results, search_model_name):
|
||||||
# Rerank results if explicitly requested, if can use inference server or if device has GPU
|
# Rerank results if explicitly requested, if can use inference server
|
||||||
# AND if we have more than one result
|
# AND if we have more than one result
|
||||||
rank_results = (
|
rank_results = (rank_results or state.cross_encoder_model[search_model_name].inference_server_enabled()) and len(
|
||||||
rank_results
|
list(hits)
|
||||||
or state.cross_encoder_model[search_model_name].inference_server_enabled()
|
) > 1
|
||||||
or state.device.type != "cpu"
|
|
||||||
) and len(list(hits)) > 1
|
|
||||||
|
|
||||||
# Score all retrieved entries using the cross-encoder
|
# Score all retrieved entries using the cross-encoder
|
||||||
if rank_results:
|
if rank_results:
|
||||||
|
|
Loading…
Reference in a new issue