Commit ·
dccb79d
1
Parent(s): 3d6141e
Update README.md
Browse files
README.md
CHANGED
|
@@ -8,11 +8,11 @@ tags:
|
|
| 8 |
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
| 12 |
|
| 13 |
-
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
## Usage (Sentence-Transformers)
|
| 18 |
|
|
@@ -28,13 +28,11 @@ Then you can use the model like this:
|
|
| 28 |
from sentence_transformers import SentenceTransformer
|
| 29 |
sentences = ["This is an example sentence", "Each sentence is converted"]
|
| 30 |
|
| 31 |
-
model = SentenceTransformer('
|
| 32 |
embeddings = model.encode(sentences)
|
| 33 |
print(embeddings)
|
| 34 |
```
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
## Usage (HuggingFace Transformers)
|
| 39 |
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
|
| 40 |
|
|
@@ -54,8 +52,8 @@ def mean_pooling(model_output, attention_mask):
|
|
| 54 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
| 55 |
|
| 56 |
# Load model from HuggingFace Hub
|
| 57 |
-
tokenizer = AutoTokenizer.from_pretrained('
|
| 58 |
-
model = AutoModel.from_pretrained('
|
| 59 |
|
| 60 |
# Tokenize sentences
|
| 61 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
@@ -71,15 +69,6 @@ print("Sentence embeddings:")
|
|
| 71 |
print(sentence_embeddings)
|
| 72 |
```
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
## Evaluation Results
|
| 77 |
-
|
| 78 |
-
<!--- Describe how your model was evaluated -->
|
| 79 |
-
|
| 80 |
-
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
|
| 81 |
-
|
| 82 |
-
|
| 83 |
## Training
|
| 84 |
The model was trained with the parameters:
|
| 85 |
|
|
@@ -123,7 +112,3 @@ SentenceTransformer(
|
|
| 123 |
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
|
| 124 |
)
|
| 125 |
```
|
| 126 |
-
|
| 127 |
-
## Citing & Authors
|
| 128 |
-
|
| 129 |
-
<!--- Describe where people can find more information -->
|
|
|
|
| 8 |
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# MPNet NLI
|
| 12 |
|
| 13 |
+
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search. It has been fine-tuned using the **S**tanford **N**atural **L**anguage **I**nference dataset and returns MRR@10 and MAP scores of ~0.95 on the SNLI test set.
|
| 14 |
|
| 15 |
+
Find more info from [James Briggs on YouTube](https://youtube.com/c/jamesbriggs) or in the [**free** NLP for Semantic Search ebook](https://pinecone.io/learn/nlp).
|
| 16 |
|
| 17 |
## Usage (Sentence-Transformers)
|
| 18 |
|
|
|
|
| 28 |
from sentence_transformers import SentenceTransformer
|
| 29 |
sentences = ["This is an example sentence", "Each sentence is converted"]
|
| 30 |
|
| 31 |
+
model = SentenceTransformer('jamescalam/mpnet-snli')
|
| 32 |
embeddings = model.encode(sentences)
|
| 33 |
print(embeddings)
|
| 34 |
```
|
| 35 |
|
|
|
|
|
|
|
| 36 |
## Usage (HuggingFace Transformers)
|
| 37 |
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
|
| 38 |
|
|
|
|
| 52 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
| 53 |
|
| 54 |
# Load model from HuggingFace Hub
|
| 55 |
+
tokenizer = AutoTokenizer.from_pretrained('jamescalam/mpnet-snli')
|
| 56 |
+
model = AutoModel.from_pretrained('jamescalam/mpnet-snli')
|
| 57 |
|
| 58 |
# Tokenize sentences
|
| 59 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
|
|
| 69 |
print(sentence_embeddings)
|
| 70 |
```
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
## Training
|
| 73 |
The model was trained with the parameters:
|
| 74 |
|
|
|
|
| 112 |
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
|
| 113 |
)
|
| 114 |
```
|
|
|
|
|
|
|
|
|
|
|
|