Skip to content

Commit

Permalink
Update instructor-embedder.md (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanSara authored Jan 17, 2024
1 parent 68c06b8 commit ac39d93
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions integrations/instructor-embedder.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pip install instructor-embedders-haystack

## Usage

1. To initialize the `InstructorTextEmbedder` or `InstructorDocumentEmbedder` you need to pass Local path or name of the model in Hugging Face's model hub, such as `'hkunlp/instructor-base'`, using the `model_name_or_path` parameter.
1. To initialize the `InstructorTextEmbedder` or `InstructorDocumentEmbedder` you need to pass Local path or name of the model in Hugging Face's model hub, such as `'hkunlp/instructor-base'`, using the `model` parameter.
2. The instruction string to be used while computing domain-specific embeddings needs to be passed using the `instruction` parameter.


Expand All @@ -85,7 +85,7 @@ instruction = (
)

text_embedder = InstructorTextEmbedder(
model_name_or_path="hkunlp/instructor-base", instruction=instruction,
model="hkunlp/instructor-base", instruction=instruction,
device="cpu"
)
text_embedder.warm_up()
Expand All @@ -104,7 +104,7 @@ from haystack.preview.dataclasses import Document
doc_embedding_instruction = "Represent the Medical Document for retrieval:"

doc_embedder = InstructorDocumentEmbedder(
model_name_or_path="hkunlp/instructor-base",
model="hkunlp/instructor-base",
instruction=doc_embedding_instruction,
batch_size=32,
device="cpu",
Expand Down Expand Up @@ -166,7 +166,7 @@ doc_store = InMemoryDocumentStore(embedding_similarity_function="cosine")
doc_embedding_instruction = "Represent the News Article for retrieval:"
# Create an InstructorDocumentEmbedder instance with specified parameters
doc_embedder = InstructorDocumentEmbedder(
model_name_or_path="hkunlp/instructor-base",
model="hkunlp/instructor-base",
instruction=doc_embedding_instruction,
batch_size=32,
device="cpu",
Expand Down Expand Up @@ -211,7 +211,7 @@ query_embedding_instruction = (
)
# Create an InstructorTextEmbedder instance for query embedding
text_embedder = InstructorTextEmbedder(
model_name_or_path="hkunlp/instructor-base",
model="hkunlp/instructor-base",
instruction=query_embedding_instruction,
device="cpu",
)
Expand Down

0 comments on commit ac39d93

Please sign in to comment.