Tom Aarsen
commited on
Commit
·
d422465
1
Parent(s):
7c8af9e
Update the snippet slightly
Browse files
README.md
CHANGED
|
@@ -139,7 +139,7 @@ pip install sentence-transformers
|
|
| 139 |
```python
|
| 140 |
from sentence_transformers import SentenceTransformer
|
| 141 |
|
| 142 |
-
attn_implementation = "eager"
|
| 143 |
model = SentenceTransformer(
|
| 144 |
"nvidia/llama-embed-nemotron-8b",
|
| 145 |
trust_remote_code=True,
|
|
@@ -155,6 +155,7 @@ documents = [
|
|
| 155 |
"Market prices are determined by the relationship between how much people want to buy a product and how much is available for sale, with scarcity driving prices up and abundance driving them down.",
|
| 156 |
]
|
| 157 |
|
|
|
|
| 158 |
query_embeddings = model.encode_query(queries)
|
| 159 |
document_embeddings = model.encode_document(documents)
|
| 160 |
|
|
|
|
| 139 |
```python
|
| 140 |
from sentence_transformers import SentenceTransformer
|
| 141 |
|
| 142 |
+
attn_implementation = "eager" # Or "flash_attention_2"
|
| 143 |
model = SentenceTransformer(
|
| 144 |
"nvidia/llama-embed-nemotron-8b",
|
| 145 |
trust_remote_code=True,
|
|
|
|
| 155 |
"Market prices are determined by the relationship between how much people want to buy a product and how much is available for sale, with scarcity driving prices up and abundance driving them down.",
|
| 156 |
]
|
| 157 |
|
| 158 |
+
# NOTE: encode_query uses the "query" prompt automatically
|
| 159 |
query_embeddings = model.encode_query(queries)
|
| 160 |
document_embeddings = model.encode_document(documents)
|
| 161 |
|