Sentence Similarity
sentence-transformers
PyTorch
English
distilbert
sentence similarity
text-embeddings-inference
Instructions to use Sakil/sentence_similarity_semantic_search with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Sakil/sentence_similarity_semantic_search with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Sakil/sentence_similarity_semantic_search") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Commit ·
70f408d
1
Parent(s): af313db
Made the code really look like code so, it was confusing for newbies like me, to find something i can copy paste (#1)
Browse files- Made the code (to be copied) really look like code so, it was confusing for newbies like me, to find something i can copy paste (f415fcd5fdcc56995d51869f064237b6794b450d)
Co-authored-by: Vishal Vishwajeet <vishal-1230@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -32,6 +32,7 @@ pipeline_tag: sentence-similarity
|
|
| 32 |
|
| 33 |
# pip install -U sentence-transformers
|
| 34 |
|
|
|
|
| 35 |
from sentence_transformers import SentenceTransformer, InputExample, losses
|
| 36 |
import pandas as pd
|
| 37 |
from sentence_transformers import SentenceTransformer, InputExample
|
|
@@ -75,7 +76,7 @@ print("Top-5 most similar pairs:")
|
|
| 75 |
for score, i, j in all_sentence_combinations[0:5]:
|
| 76 |
|
| 77 |
print("{} \t {} \t {:.4f}".format(sentences[i], sentences[j], cos_sim[i][j]))
|
| 78 |
-
|
| 79 |
|
| 80 |
|
| 81 |
# Github: [Sakil Ansari](https://github.com/Sakil786/sentence_similarity_semantic_search)
|
|
|
|
| 32 |
|
| 33 |
# pip install -U sentence-transformers
|
| 34 |
|
| 35 |
+
```
|
| 36 |
from sentence_transformers import SentenceTransformer, InputExample, losses
|
| 37 |
import pandas as pd
|
| 38 |
from sentence_transformers import SentenceTransformer, InputExample
|
|
|
|
| 76 |
for score, i, j in all_sentence_combinations[0:5]:
|
| 77 |
|
| 78 |
print("{} \t {} \t {:.4f}".format(sentences[i], sentences[j], cos_sim[i][j]))
|
| 79 |
+
```
|
| 80 |
|
| 81 |
|
| 82 |
# Github: [Sakil Ansari](https://github.com/Sakil786/sentence_similarity_semantic_search)
|