Update README.md
Browse files
README.md
CHANGED
|
@@ -12,3 +12,23 @@ tags:
|
|
| 12 |
base_model: microsoft/mpnet-base
|
| 13 |
---
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
base_model: microsoft/mpnet-base
|
| 13 |
---
|
| 14 |
|
| 15 |
+
from sentence_transformers import SentenceTransformer
|
| 16 |
+
|
| 17 |
+
```python
|
| 18 |
+
# Download from the 🤗 Hub
|
| 19 |
+
model = SentenceTransformer("ayoubkirouane/Mpnet-base-ALL-NLI")
|
| 20 |
+
# Run inference
|
| 21 |
+
sentences = [
|
| 22 |
+
'a baby smiling',
|
| 23 |
+
'The boy is smiling',
|
| 24 |
+
'The girl is standing.',
|
| 25 |
+
]
|
| 26 |
+
embeddings = model.encode(sentences)
|
| 27 |
+
print(embeddings.shape)
|
| 28 |
+
# [3, 768]
|
| 29 |
+
|
| 30 |
+
# Get the similarity scores for the embeddings
|
| 31 |
+
similarities = model.similarity(embeddings, embeddings)
|
| 32 |
+
print(similarities.shape)
|
| 33 |
+
# [3, 3]
|
| 34 |
+
```
|