Skip to content

How to use "sentence_transformers/all-mpnet-base-v2" as a retriever model? #5415

Closed Answered by anakin87
dkbs12 asked this question in Questions
Discussion options

You must be logged in to vote

Hey @dkbs12, the following code works for me.
Please make sure to use the correct model name.

from haystack import Document
from haystack.nodes import EmbeddingRetriever
from haystack.document_stores import InMemoryDocumentStore

document_store = InMemoryDocumentStore()

doc = Document('example doc')

document_store.write_documents([doc])

retriever = EmbeddingRetriever(
document_store=document_store,
embedding_model="sentence-transformers/all-mpnet-base-v2"
)

document_store.update_embeddings(retriever)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@dkbs12
Comment options

@vblagoje
Comment options

Comment options

You must be logged in to vote
1 reply
@dkbs12
Comment options

Answer selected by anakin87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants