Spaces:
Runtime error
Runtime error
derek-thomas
commited on
Commit
·
1174ad3
1
Parent(s):
c5200c8
Debugging attempt
Browse files- backend/semantic_search.py +32 -30
backend/semantic_search.py
CHANGED
@@ -1,31 +1,33 @@
|
|
1 |
-
import time
|
2 |
-
import logging
|
3 |
-
from qdrant_haystack import QdrantDocumentStore
|
4 |
-
from haystack.nodes import EmbeddingRetriever
|
5 |
-
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
logging.basicConfig(level=logging.INFO)
|
9 |
-
logger = logging.getLogger(__name__)
|
10 |
-
|
11 |
-
# Start the timer for loading the QdrantDocumentStore
|
12 |
-
start_time = time.perf_counter()
|
13 |
-
|
14 |
-
proj_dir = Path(__file__).parents[1]
|
15 |
-
qd_document_store = QdrantDocumentStore(path=str(proj_dir/'Qdrant'), index='RAGDemo')
|
16 |
-
|
17 |
-
# Log the time taken to load the QdrantDocumentStore
|
18 |
-
document_store_loading_time = time.perf_counter() - start_time
|
19 |
-
logger.info(f"Time taken to load QdrantDocumentStore: {document_store_loading_time:.6f} seconds")
|
20 |
-
|
21 |
-
# Start the timer for loading the EmbeddingRetriever
|
22 |
-
start_time = time.perf_counter()
|
23 |
-
|
24 |
-
qd_retriever = EmbeddingRetriever(document_store=qd_document_store,
|
25 |
-
embedding_model="BAAI/bge-base-en-v1.5",
|
26 |
-
model_format="sentence_transformers",
|
27 |
-
use_gpu=False)
|
28 |
-
|
29 |
-
# Log the time taken to load the EmbeddingRetriever
|
30 |
-
retriever_loading_time = time.perf_counter() - start_time
|
31 |
-
logger.info(f"Time taken to load EmbeddingRetriever: {retriever_loading_time:.6f} seconds")
|
|
|
1 |
+
# import time
|
2 |
+
# import logging
|
3 |
+
# from qdrant_haystack import QdrantDocumentStore
|
4 |
+
# from haystack.nodes import EmbeddingRetriever
|
5 |
+
# from pathlib import Path
|
6 |
+
#
|
7 |
+
# # Setting up the logging
|
8 |
+
# logging.basicConfig(level=logging.INFO)
|
9 |
+
# logger = logging.getLogger(__name__)
|
10 |
+
#
|
11 |
+
# # Start the timer for loading the QdrantDocumentStore
|
12 |
+
# start_time = time.perf_counter()
|
13 |
+
#
|
14 |
+
# proj_dir = Path(__file__).parents[1]
|
15 |
+
# qd_document_store = QdrantDocumentStore(path=str(proj_dir/'Qdrant'), index='RAGDemo')
|
16 |
+
#
|
17 |
+
# # Log the time taken to load the QdrantDocumentStore
|
18 |
+
# document_store_loading_time = time.perf_counter() - start_time
|
19 |
+
# logger.info(f"Time taken to load QdrantDocumentStore: {document_store_loading_time:.6f} seconds")
|
20 |
+
#
|
21 |
+
# # Start the timer for loading the EmbeddingRetriever
|
22 |
+
# start_time = time.perf_counter()
|
23 |
+
#
|
24 |
+
# qd_retriever = EmbeddingRetriever(document_store=qd_document_store,
|
25 |
+
# embedding_model="BAAI/bge-base-en-v1.5",
|
26 |
+
# model_format="sentence_transformers",
|
27 |
+
# use_gpu=False)
|
28 |
+
#
|
29 |
+
# # Log the time taken to load the EmbeddingRetriever
|
30 |
+
# retriever_loading_time = time.perf_counter() - start_time
|
31 |
+
# logger.info(f"Time taken to load EmbeddingRetriever: {retriever_loading_time:.6f} seconds")
|
32 |
|
33 |
+
qd_retriever = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|