Fix query_prompt_name variable name
#15
by
tomaarsen
HF staff
- opened
README.md
CHANGED
@@ -5480,7 +5480,7 @@ from sentence_transformers import SentenceTransformer
|
|
5480 |
|
5481 |
# This model supports two prompts: "s2p_query" and "s2s_query" for sentence-to-passage and sentence-to-sentence tasks, respectively.
|
5482 |
# They are defined in `config_sentence_transformers.json`
|
5483 |
-
|
5484 |
queries = [
|
5485 |
"What are some ways to reduce stress?",
|
5486 |
"What are the benefits of drinking green tea?",
|
@@ -5492,7 +5492,7 @@ docs = [
|
|
5492 |
]
|
5493 |
|
5494 |
# !The default dimension is 1024, if you need other dimensions, please clone the model and modify `modules.json` to replace `2_Dense_1024` with another dimension, e.g. `2_Dense_256` or `2_Dense_8192` !
|
5495 |
-
model = SentenceTransformer("
|
5496 |
query_embeddings = model.encode(queries, prompt_name=query_prompt_name)
|
5497 |
doc_embeddings = model.encode(docs)
|
5498 |
print(query_embeddings.shape, doc_embeddings.shape)
|
|
|
5480 |
|
5481 |
# This model supports two prompts: "s2p_query" and "s2s_query" for sentence-to-passage and sentence-to-sentence tasks, respectively.
|
5482 |
# They are defined in `config_sentence_transformers.json`
|
5483 |
+
query_prompt_name = "s2p_query"
|
5484 |
queries = [
|
5485 |
"What are some ways to reduce stress?",
|
5486 |
"What are the benefits of drinking green tea?",
|
|
|
5492 |
]
|
5493 |
|
5494 |
# !The default dimension is 1024, if you need other dimensions, please clone the model and modify `modules.json` to replace `2_Dense_1024` with another dimension, e.g. `2_Dense_256` or `2_Dense_8192` !
|
5495 |
+
model = SentenceTransformer("dunzhang/stella_en_1.5B_v5", trust_remote_code=True).cuda()
|
5496 |
query_embeddings = model.encode(queries, prompt_name=query_prompt_name)
|
5497 |
doc_embeddings = model.encode(docs)
|
5498 |
print(query_embeddings.shape, doc_embeddings.shape)
|