Commit ·
cf7db3d
1
Parent(s): c7ce179
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,11 +7,11 @@ tags:
|
|
| 7 |
- transformers
|
| 8 |
---
|
| 9 |
|
| 10 |
-
#
|
| 11 |
|
| 12 |
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.
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
## Usage (Sentence-Transformers)
|
| 17 |
|
|
@@ -27,7 +27,7 @@ Then you can use the model like this:
|
|
| 27 |
from sentence_transformers import SentenceTransformer
|
| 28 |
sentences = ["This is an example sentence", "Each sentence is converted"]
|
| 29 |
|
| 30 |
-
model = SentenceTransformer('
|
| 31 |
embeddings = model.encode(sentences)
|
| 32 |
print(embeddings)
|
| 33 |
```
|
|
@@ -53,8 +53,8 @@ def mean_pooling(model_output, attention_mask):
|
|
| 53 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
| 54 |
|
| 55 |
# Load model from HuggingFace Hub
|
| 56 |
-
tokenizer = AutoTokenizer.from_pretrained('
|
| 57 |
-
model = AutoModel.from_pretrained('
|
| 58 |
|
| 59 |
# Tokenize sentences
|
| 60 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
@@ -70,15 +70,6 @@ print("Sentence embeddings:")
|
|
| 70 |
print(sentence_embeddings)
|
| 71 |
```
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
## Evaluation Results
|
| 76 |
-
|
| 77 |
-
<!--- Describe how your model was evaluated -->
|
| 78 |
-
|
| 79 |
-
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
|
| 80 |
-
|
| 81 |
-
|
| 82 |
## Training
|
| 83 |
The model was trained with the parameters:
|
| 84 |
|
|
@@ -119,7 +110,3 @@ SentenceTransformer(
|
|
| 119 |
(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})
|
| 120 |
)
|
| 121 |
```
|
| 122 |
-
|
| 123 |
-
## Citing & Authors
|
| 124 |
-
|
| 125 |
-
<!--- Describe where people can find more information -->
|
|
|
|
| 7 |
- transformers
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# Gold-only BERT STSb
|
| 11 |
|
| 12 |
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.
|
| 13 |
|
| 14 |
+
It is used as a demo model within the [NLP for Semantic Search course](https://www.pinecone.io/learn/nlp), for the chapter on [In-domain Data Augmentation with BERT](https://www.pinecone.io/learn/data-augmentation/).
|
| 15 |
|
| 16 |
## Usage (Sentence-Transformers)
|
| 17 |
|
|
|
|
| 27 |
from sentence_transformers import SentenceTransformer
|
| 28 |
sentences = ["This is an example sentence", "Each sentence is converted"]
|
| 29 |
|
| 30 |
+
model = SentenceTransformer('bert-stsb-gold')
|
| 31 |
embeddings = model.encode(sentences)
|
| 32 |
print(embeddings)
|
| 33 |
```
|
|
|
|
| 53 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
| 54 |
|
| 55 |
# Load model from HuggingFace Hub
|
| 56 |
+
tokenizer = AutoTokenizer.from_pretrained('bert-stsb-gold')
|
| 57 |
+
model = AutoModel.from_pretrained('bert-stsb-gold')
|
| 58 |
|
| 59 |
# Tokenize sentences
|
| 60 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
|
|
| 70 |
print(sentence_embeddings)
|
| 71 |
```
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
## Training
|
| 74 |
The model was trained with the parameters:
|
| 75 |
|
|
|
|
| 110 |
(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})
|
| 111 |
)
|
| 112 |
```
|
|
|
|
|
|
|
|
|
|
|
|