Add image embedding task and test case

This commit is contained in:
liyaxing
2023-09-27 17:24:38 +08:00
parent e13e31aae9
commit 87f82ec9e2
4 changed files with 32 additions and 4 deletions
+4 -1
View File
@@ -67,7 +67,10 @@ def test_st():
]
# Compute embeddings
embeddings = model.encode(sentences, convert_to_tensor=True)
#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)