Spaces:
Paused
Paused
derek-thomas
commited on
Commit
·
cf3e0e9
1
Parent(s):
f9509ab
Cleaning unused code
Browse files- utilities/retrievers.py +0 -26
utilities/retrievers.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import pickle
|
| 2 |
-
from logging import getLogger
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
import torch
|
| 6 |
-
from haystack.nodes import EmbeddingRetriever
|
| 7 |
-
from qdrant_haystack import QdrantDocumentStore
|
| 8 |
-
|
| 9 |
-
logger = getLogger(__name__)
|
| 10 |
-
|
| 11 |
-
proj_dir = Path(__file__).parents[1]
|
| 12 |
-
|
| 13 |
-
st_document_store_path = proj_dir / 'haystack_pickles' / 'simple-wiki_all-mpnet-base-v2_document-store.pkl'
|
| 14 |
-
|
| 15 |
-
logger.warning('Loading Document Store...')
|
| 16 |
-
with open(st_document_store_path, 'rb') as handle:
|
| 17 |
-
st_document_store = pickle.load(handle)
|
| 18 |
-
logger.warning('Loaded Document Store...')
|
| 19 |
-
|
| 20 |
-
qd_document_store = QdrantDocumentStore(path=str(proj_dir/'Qdrant'))
|
| 21 |
-
|
| 22 |
-
qd_document_store.main_device = torch.device('cpu')
|
| 23 |
-
qd_retriever = EmbeddingRetriever(document_store=qd_document_store,
|
| 24 |
-
embedding_model="sentence-transformers/all-mpnet-base-v2",
|
| 25 |
-
model_format="sentence_transformers",
|
| 26 |
-
use_gpu=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|