File size: 1,230 Bytes
d2943d6
 
9e6b8ed
 
 
 
d2943d6
 
 
 
 
 
 
9e6b8ed
 
d2943d6
 
 
 
 
 
 
 
9e6b8ed
 
 
f9509ab
d2943d6
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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=True)

# 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")