-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get embeddings from a dense retriever #226
Comments
Yes, the goal of the haystack/tutorials/Tutorial6_Better_Retrieval_via_DPR.py Lines 51 to 56 in b886e05
|
In the case that we just want to generate embeddings for strings, could we go about passing the function an empty document store? (given that we return the embeddings instead of the docs as above) |
If you just want to create embedding you can use:
Note, that for DPR the two methods use different encoder models while for the EmbeddingRetriever both use the same. |
Great! thanks |
hello |
Hi, I've been trying to find out why the embeddingretriever is returning just an empty list and found out that the embeddings were indeed generated, bur the retrieve() method is trying to return documents instead? I had to change the method to look like this:
(haystack/retriever/dense lines 245-247)
def retrieve(self, query: str, filters: dict = None, top_k: int = 10, index: str = None) -> List[Document]:
if index is None:
index = self.document_store.index
query_emb = self.embed(texts=[query])
# documents = self.document_store.query_by_embedding(query_emb=query_emb[0], filters=filters,
# top_k=top_k, index=index)
# return documents
return query_emb
I'm trying to understand this function's purpose - is it meant to return documents relevant to our input strings? Why is this trying to return documents?
The text was updated successfully, but these errors were encountered: