Update README.md
Browse files
README.md
CHANGED
@@ -38,6 +38,12 @@ SentenceTransformer(
|
|
38 |
|
39 |
## Usage
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
### Direct Usage (Sentence Transformers)
|
42 |
|
43 |
First install the Sentence Transformers library:
|
@@ -53,11 +59,19 @@ from sentence_transformers import SentenceTransformer
|
|
53 |
# Download from the 🤗 Hub
|
54 |
model = SentenceTransformer("ZhishanQ/UniHGKR-base-beir")
|
55 |
# Run inference
|
|
|
|
|
|
|
|
|
56 |
sentences = [
|
57 |
'The weather is lovely today.',
|
58 |
"It's so sunny outside!",
|
59 |
'He drove to the stadium.',
|
60 |
]
|
|
|
|
|
|
|
|
|
61 |
embeddings = model.encode(sentences)
|
62 |
print(embeddings.shape)
|
63 |
# [3, 768]
|
|
|
38 |
|
39 |
## Usage
|
40 |
|
41 |
+
Use the instructions to achieve the best performance from the model:
|
42 |
+
```
|
43 |
+
general_ins = "Given a question, retrieve relevant evidence that can answer the question from all knowledge sources:"
|
44 |
+
single_source_inst = "Given a question, retrieve relevant evidence that can answer the question from Text sources:"
|
45 |
+
```
|
46 |
+
|
47 |
### Direct Usage (Sentence Transformers)
|
48 |
|
49 |
First install the Sentence Transformers library:
|
|
|
59 |
# Download from the 🤗 Hub
|
60 |
model = SentenceTransformer("ZhishanQ/UniHGKR-base-beir")
|
61 |
# Run inference
|
62 |
+
|
63 |
+
general_ins = "Given a question, retrieve relevant evidence that can answer the question from all knowledge sources:"
|
64 |
+
single_source_inst = "Given a question, retrieve relevant evidence that can answer the question from Text sources:"
|
65 |
+
|
66 |
sentences = [
|
67 |
'The weather is lovely today.',
|
68 |
"It's so sunny outside!",
|
69 |
'He drove to the stadium.',
|
70 |
]
|
71 |
+
|
72 |
+
# Prepend each sentence with the instruction
|
73 |
+
updated_sentences = [f"{single_source_inst} {sentence}" for sentence in sentences]
|
74 |
+
|
75 |
embeddings = model.encode(sentences)
|
76 |
print(embeddings.shape)
|
77 |
# [3, 768]
|