Add sentence-transformer local text embedding supports

This commit is contained in:
liyaxing
2023-09-25 16:22:15 +08:00
committed by tsukasa
parent 1de94a4d06
commit f07976366f
3 changed files with 7 additions and 4 deletions
+2
View File
@@ -67,11 +67,13 @@ def test_st():
]
# Compute embeddings
#embeddings = model.encode(sentences, convert_to_tensor=True)
embeddings = model.encode(sentences)
print("embeddings as follows: ")
print(embeddings)
# Compute cosine-similarities for each sentence with each other sentence
cosine_scores = util.cos_sim(embeddings, embeddings)