jamescalam
commited on
Commit
•
b432ebb
1
Parent(s):
54b6728
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,14 +27,13 @@ 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 |
```
|
34 |
|
35 |
-
|
36 |
-
|
37 |
## Usage (HuggingFace Transformers)
|
|
|
38 |
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.
|
39 |
|
40 |
```python
|
@@ -53,8 +52,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')
|
@@ -71,14 +70,6 @@ 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 |
+
# Augmented SBERT 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-aug')
|
31 |
embeddings = model.encode(sentences)
|
32 |
print(embeddings)
|
33 |
```
|
34 |
|
|
|
|
|
35 |
## Usage (HuggingFace Transformers)
|
36 |
+
|
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 |
|
39 |
```python
|
|
|
52 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
53 |
|
54 |
# Load model from HuggingFace Hub
|
55 |
+
tokenizer = AutoTokenizer.from_pretrained('bert-stsb-aug')
|
56 |
+
model = AutoModel.from_pretrained('bert-stsb-aug')
|
57 |
|
58 |
# Tokenize sentences
|
59 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
|
70 |
```
|
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 |
```
|
|
|
|
|
|
|
|