Update README.md
Browse filesfix: the prompt example in code
README.md
CHANGED
|
@@ -99,15 +99,9 @@ embeddings = model.encode(
|
|
| 99 |
show_progress_bar=True,
|
| 100 |
)
|
| 101 |
print(embeddings)
|
| 102 |
-
'''
|
| 103 |
-
[[-0.01867676 0.02319336 0.00280762 ... -0.02075195 0.00196838
|
| 104 |
-
-0.0703125 ]
|
| 105 |
-
[-0.0067749 0.03491211 0.01434326 ... -0.0043335 0.00509644
|
| 106 |
-
-0.04174805]]
|
| 107 |
-
'''
|
| 108 |
```
|
| 109 |
|
| 110 |
-
Or you can use `encode_query` and `encode_document` to automatically add the default prompt for queries (`"Instruct: Given a query, retrieve documents that answer the query \
|
| 111 |
|
| 112 |
```python
|
| 113 |
from sentence_transformers import SentenceTransformer
|
|
@@ -137,10 +131,6 @@ document_embeddings = model.encode_document(documents)
|
|
| 137 |
|
| 138 |
similarities = model.similarity(query_embeddings, document_embeddings)
|
| 139 |
print(similarities)
|
| 140 |
-
'''
|
| 141 |
-
tensor([[0.9034, 0.2563],
|
| 142 |
-
[0.3153, 0.7396]])
|
| 143 |
-
'''
|
| 144 |
```
|
| 145 |
|
| 146 |
### vllm support
|
|
|
|
| 99 |
show_progress_bar=True,
|
| 100 |
)
|
| 101 |
print(embeddings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
```
|
| 103 |
|
| 104 |
+
Or you can use `encode_query` and `encode_document` to automatically add the default prompt for queries (`"Instruct: Given a query, retrieve documents that answer the query \nQuery: "`) and documents (`""`), respectively.
|
| 105 |
|
| 106 |
```python
|
| 107 |
from sentence_transformers import SentenceTransformer
|
|
|
|
| 131 |
|
| 132 |
similarities = model.similarity(query_embeddings, document_embeddings)
|
| 133 |
print(similarities)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
```
|
| 135 |
|
| 136 |
### vllm support
|