Tom Aarsen
commited on
Commit
•
7a25c26
1
Parent(s):
6d898db
Fix query_prompt_name variable name; update model author
Browse files
README.md
CHANGED
@@ -5481,7 +5481,7 @@ from sentence_transformers import SentenceTransformer
|
|
5481 |
|
5482 |
# This model supports two prompts: "s2p_query" and "s2s_query" for sentence-to-passage and sentence-to-sentence tasks, respectively.
|
5483 |
# They are defined in `config_sentence_transformers.json`
|
5484 |
-
|
5485 |
queries = [
|
5486 |
"What are some ways to reduce stress?",
|
5487 |
"What are the benefits of drinking green tea?",
|
@@ -5493,7 +5493,7 @@ docs = [
|
|
5493 |
]
|
5494 |
|
5495 |
# !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` !
|
5496 |
-
model = SentenceTransformer("
|
5497 |
query_embeddings = model.encode(queries, prompt_name=query_prompt_name)
|
5498 |
doc_embeddings = model.encode(docs)
|
5499 |
print(query_embeddings.shape, doc_embeddings.shape)
|
|
|
5481 |
|
5482 |
# This model supports two prompts: "s2p_query" and "s2s_query" for sentence-to-passage and sentence-to-sentence tasks, respectively.
|
5483 |
# They are defined in `config_sentence_transformers.json`
|
5484 |
+
query_prompt_name = "s2p_query"
|
5485 |
queries = [
|
5486 |
"What are some ways to reduce stress?",
|
5487 |
"What are the benefits of drinking green tea?",
|
|
|
5493 |
]
|
5494 |
|
5495 |
# !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` !
|
5496 |
+
model = SentenceTransformer("dunzhang/stella_en_400M_v5", trust_remote_code=True).cuda()
|
5497 |
query_embeddings = model.encode(queries, prompt_name=query_prompt_name)
|
5498 |
doc_embeddings = model.encode(docs)
|
5499 |
print(query_embeddings.shape, doc_embeddings.shape)
|