From 632f55a9e8522edb94687015f18daceb181ca929 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 16 Jun 2024 12:39:49 +0530 Subject: [PATCH] Do not default to rerank if device has GPU --- src/khoj/search_type/text_search.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/khoj/search_type/text_search.py b/src/khoj/search_type/text_search.py index a172529f..27899bd3 100644 --- a/src/khoj/search_type/text_search.py +++ b/src/khoj/search_type/text_search.py @@ -177,13 +177,11 @@ def deduplicated_search_responses(hits: List[SearchResponse]): 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 - rank_results = ( - rank_results - or state.cross_encoder_model[search_model_name].inference_server_enabled() - or state.device.type != "cpu" - ) and len(list(hits)) > 1 + rank_results = (rank_results or state.cross_encoder_model[search_model_name].inference_server_enabled()) and len( + list(hits) + ) > 1 # Score all retrieved entries using the cross-encoder if rank_results: