RAGDemo / backend /semantic_search.py
derek-thomas's picture
derek-thomas HF staff
Undoing debug
5638045
import time
import logging
from qdrant_haystack import QdrantDocumentStore
from haystack.nodes import EmbeddingRetriever
from pathlib import Path
# Setting up the logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Start the timer for loading the QdrantDocumentStore
start_time = time.perf_counter()
proj_dir = Path(__file__).parents[1]
qd_document_store = QdrantDocumentStore(path=str(proj_dir/'Qdrant'), index='RAGDemo')
# Log the time taken to load the QdrantDocumentStore
document_store_loading_time = time.perf_counter() - start_time
logger.info(f"Time taken to load QdrantDocumentStore: {document_store_loading_time:.6f} seconds")
# Start the timer for loading the EmbeddingRetriever
start_time = time.perf_counter()
qd_retriever = EmbeddingRetriever(document_store=qd_document_store,
embedding_model="BAAI/bge-base-en-v1.5",
model_format="sentence_transformers",
use_gpu=False)
# Log the time taken to load the EmbeddingRetriever
retriever_loading_time = time.perf_counter() - start_time
logger.info(f"Time taken to load EmbeddingRetriever: {retriever_loading_time:.6f} seconds")