Add new SentenceTransformer model.
Browse files- 1_Pooling/config.json +10 -0
- README.md +558 -0
- config.json +24 -0
- config_sentence_transformers.json +10 -0
- model.safetensors +3 -0
- modules.json +14 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +37 -0
- tokenizer.json +0 -0
- tokenizer_config.json +62 -0
- vocab.txt +0 -0
1_Pooling/config.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 768,
|
3 |
+
"pooling_mode_cls_token": false,
|
4 |
+
"pooling_mode_mean_tokens": true,
|
5 |
+
"pooling_mode_max_tokens": false,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
7 |
+
"pooling_mode_weightedmean_tokens": false,
|
8 |
+
"pooling_mode_lasttoken": false,
|
9 |
+
"include_prompt": true
|
10 |
+
}
|
README.md
ADDED
@@ -0,0 +1,558 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
library_name: sentence-transformers
|
5 |
+
tags:
|
6 |
+
- sentence-transformers
|
7 |
+
- sentence-similarity
|
8 |
+
- feature-extraction
|
9 |
+
- loss:AdaptiveLayerLoss
|
10 |
+
- loss:CoSENTLoss
|
11 |
+
base_model: distilbert/distilbert-base-uncased
|
12 |
+
metrics:
|
13 |
+
- pearson_cosine
|
14 |
+
- spearman_cosine
|
15 |
+
- pearson_manhattan
|
16 |
+
- spearman_manhattan
|
17 |
+
- pearson_euclidean
|
18 |
+
- spearman_euclidean
|
19 |
+
- pearson_dot
|
20 |
+
- spearman_dot
|
21 |
+
- pearson_max
|
22 |
+
- spearman_max
|
23 |
+
widget:
|
24 |
+
- source_sentence: A man is speaking.
|
25 |
+
sentences:
|
26 |
+
- A man is talking.
|
27 |
+
- Breivik complains of 'ridicule'
|
28 |
+
- The dogs are chasing a cat.
|
29 |
+
- source_sentence: A plane is landing.
|
30 |
+
sentences:
|
31 |
+
- A animated airplane is landing.
|
32 |
+
- Three humans are walking a dog.
|
33 |
+
- Turkey's PM Warns Against Protests
|
34 |
+
- source_sentence: A plane in the sky.
|
35 |
+
sentences:
|
36 |
+
- Two airplanes in the sky.
|
37 |
+
- A guy is playing an instrument.
|
38 |
+
- Obama urges no new sanctions on Iran
|
39 |
+
- source_sentence: A boy is vacuuming.
|
40 |
+
sentences:
|
41 |
+
- A little boy is vacuuming the floor.
|
42 |
+
- Two dogs fighting in the snow.
|
43 |
+
- Gunmen 'kill 10 tourists' in Kashmir
|
44 |
+
- source_sentence: A woman is dancing.
|
45 |
+
sentences:
|
46 |
+
- Women are dancing.
|
47 |
+
- Two dogs fighting in the snow.
|
48 |
+
- A dog digs a hole in a yard.
|
49 |
+
pipeline_tag: sentence-similarity
|
50 |
+
co2_eq_emissions:
|
51 |
+
emissions: 5.048832905925286
|
52 |
+
energy_consumed: 0.012988955307472783
|
53 |
+
source: codecarbon
|
54 |
+
training_type: fine-tuning
|
55 |
+
on_cloud: false
|
56 |
+
cpu_model: 13th Gen Intel(R) Core(TM) i7-13700K
|
57 |
+
ram_total_size: 31.777088165283203
|
58 |
+
hours_used: 0.069
|
59 |
+
hardware_used: 1 x NVIDIA GeForce RTX 3090
|
60 |
+
model-index:
|
61 |
+
- name: SentenceTransformer based on distilbert/distilbert-base-uncased
|
62 |
+
results:
|
63 |
+
- task:
|
64 |
+
type: semantic-similarity
|
65 |
+
name: Semantic Similarity
|
66 |
+
dataset:
|
67 |
+
name: sts dev
|
68 |
+
type: sts-dev
|
69 |
+
metrics:
|
70 |
+
- type: pearson_cosine
|
71 |
+
value: 0.8652370775930345
|
72 |
+
name: Pearson Cosine
|
73 |
+
- type: spearman_cosine
|
74 |
+
value: 0.8727506004002163
|
75 |
+
name: Spearman Cosine
|
76 |
+
- type: pearson_manhattan
|
77 |
+
value: 0.8625714457714474
|
78 |
+
name: Pearson Manhattan
|
79 |
+
- type: spearman_manhattan
|
80 |
+
value: 0.8640763670277021
|
81 |
+
name: Spearman Manhattan
|
82 |
+
- type: pearson_euclidean
|
83 |
+
value: 0.8629790773940799
|
84 |
+
name: Pearson Euclidean
|
85 |
+
- type: spearman_euclidean
|
86 |
+
value: 0.8648628595939388
|
87 |
+
name: Spearman Euclidean
|
88 |
+
- type: pearson_dot
|
89 |
+
value: 0.7647366616229355
|
90 |
+
name: Pearson Dot
|
91 |
+
- type: spearman_dot
|
92 |
+
value: 0.7748666009336691
|
93 |
+
name: Spearman Dot
|
94 |
+
- type: pearson_max
|
95 |
+
value: 0.8652370775930345
|
96 |
+
name: Pearson Max
|
97 |
+
- type: spearman_max
|
98 |
+
value: 0.8727506004002163
|
99 |
+
name: Spearman Max
|
100 |
+
- task:
|
101 |
+
type: semantic-similarity
|
102 |
+
name: Semantic Similarity
|
103 |
+
dataset:
|
104 |
+
name: sts test
|
105 |
+
type: sts-test
|
106 |
+
metrics:
|
107 |
+
- type: pearson_cosine
|
108 |
+
value: 0.8353553575743735
|
109 |
+
name: Pearson Cosine
|
110 |
+
- type: spearman_cosine
|
111 |
+
value: 0.8456023773246713
|
112 |
+
name: Spearman Cosine
|
113 |
+
- type: pearson_manhattan
|
114 |
+
value: 0.8492310055929263
|
115 |
+
name: Pearson Manhattan
|
116 |
+
- type: spearman_manhattan
|
117 |
+
value: 0.8451007047564367
|
118 |
+
name: Spearman Manhattan
|
119 |
+
- type: pearson_euclidean
|
120 |
+
value: 0.8493640569080374
|
121 |
+
name: Pearson Euclidean
|
122 |
+
- type: spearman_euclidean
|
123 |
+
value: 0.8449411972438509
|
124 |
+
name: Spearman Euclidean
|
125 |
+
- type: pearson_dot
|
126 |
+
value: 0.6924412597499117
|
127 |
+
name: Pearson Dot
|
128 |
+
- type: spearman_dot
|
129 |
+
value: 0.6793562175238733
|
130 |
+
name: Spearman Dot
|
131 |
+
- type: pearson_max
|
132 |
+
value: 0.8493640569080374
|
133 |
+
name: Pearson Max
|
134 |
+
- type: spearman_max
|
135 |
+
value: 0.8456023773246713
|
136 |
+
name: Spearman Max
|
137 |
+
---
|
138 |
+
|
139 |
+
# SentenceTransformer based on distilbert/distilbert-base-uncased
|
140 |
+
|
141 |
+
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [distilbert/distilbert-base-uncased](https://huggingface.co/distilbert/distilbert-base-uncased) on the [sentence-transformers/stsb](https://huggingface.co/datasets/sentence-transformers/stsb) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
|
142 |
+
|
143 |
+
## Model Details
|
144 |
+
|
145 |
+
### Model Description
|
146 |
+
- **Model Type:** Sentence Transformer
|
147 |
+
- **Base model:** [distilbert/distilbert-base-uncased](https://huggingface.co/distilbert/distilbert-base-uncased) <!-- at revision 6cdc0aad91f5ae2e6712e91bc7b65d1cf5c05411 -->
|
148 |
+
- **Maximum Sequence Length:** 512 tokens
|
149 |
+
- **Output Dimensionality:** 768 tokens
|
150 |
+
- **Similarity Function:** Cosine Similarity
|
151 |
+
- **Training Dataset:**
|
152 |
+
- [sentence-transformers/stsb](https://huggingface.co/datasets/sentence-transformers/stsb)
|
153 |
+
- **Language:** en
|
154 |
+
<!-- - **License:** Unknown -->
|
155 |
+
|
156 |
+
### Model Sources
|
157 |
+
|
158 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
159 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
160 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
161 |
+
|
162 |
+
### Full Model Architecture
|
163 |
+
|
164 |
+
```
|
165 |
+
SentenceTransformer(
|
166 |
+
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: DistilBertModel
|
167 |
+
(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, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
|
168 |
+
)
|
169 |
+
```
|
170 |
+
|
171 |
+
## Usage
|
172 |
+
|
173 |
+
### Direct Usage (Sentence Transformers)
|
174 |
+
|
175 |
+
First install the Sentence Transformers library:
|
176 |
+
|
177 |
+
```bash
|
178 |
+
pip install -U sentence-transformers
|
179 |
+
```
|
180 |
+
|
181 |
+
Then you can load this model and run inference.
|
182 |
+
```python
|
183 |
+
from sentence_transformers import SentenceTransformer
|
184 |
+
|
185 |
+
# Download from the 🤗 Hub
|
186 |
+
model = SentenceTransformer("sentence_transformers_model_id")
|
187 |
+
# Run inference
|
188 |
+
sentences = [
|
189 |
+
'A woman is dancing.',
|
190 |
+
'Women are dancing.',
|
191 |
+
'Two dogs fighting in the snow.',
|
192 |
+
]
|
193 |
+
embeddings = model.encode(sentences)
|
194 |
+
print(embeddings.shape)
|
195 |
+
# [3, 768]
|
196 |
+
|
197 |
+
# Get the similarity scores for the embeddings
|
198 |
+
similarities = model.similarity(embeddings)
|
199 |
+
print(similarities.shape)
|
200 |
+
# [3, 3]
|
201 |
+
```
|
202 |
+
|
203 |
+
<!--
|
204 |
+
### Direct Usage (Transformers)
|
205 |
+
|
206 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
207 |
+
|
208 |
+
</details>
|
209 |
+
-->
|
210 |
+
|
211 |
+
<!--
|
212 |
+
### Downstream Usage (Sentence Transformers)
|
213 |
+
|
214 |
+
You can finetune this model on your own dataset.
|
215 |
+
|
216 |
+
<details><summary>Click to expand</summary>
|
217 |
+
|
218 |
+
</details>
|
219 |
+
-->
|
220 |
+
|
221 |
+
<!--
|
222 |
+
### Out-of-Scope Use
|
223 |
+
|
224 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
225 |
+
-->
|
226 |
+
|
227 |
+
## Evaluation
|
228 |
+
|
229 |
+
### Metrics
|
230 |
+
|
231 |
+
#### Semantic Similarity
|
232 |
+
* Dataset: `sts-dev`
|
233 |
+
* Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
|
234 |
+
|
235 |
+
| Metric | Value |
|
236 |
+
|:--------------------|:-----------|
|
237 |
+
| pearson_cosine | 0.8652 |
|
238 |
+
| **spearman_cosine** | **0.8728** |
|
239 |
+
| pearson_manhattan | 0.8626 |
|
240 |
+
| spearman_manhattan | 0.8641 |
|
241 |
+
| pearson_euclidean | 0.863 |
|
242 |
+
| spearman_euclidean | 0.8649 |
|
243 |
+
| pearson_dot | 0.7647 |
|
244 |
+
| spearman_dot | 0.7749 |
|
245 |
+
| pearson_max | 0.8652 |
|
246 |
+
| spearman_max | 0.8728 |
|
247 |
+
|
248 |
+
#### Semantic Similarity
|
249 |
+
* Dataset: `sts-test`
|
250 |
+
* Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
|
251 |
+
|
252 |
+
| Metric | Value |
|
253 |
+
|:--------------------|:-----------|
|
254 |
+
| pearson_cosine | 0.8354 |
|
255 |
+
| **spearman_cosine** | **0.8456** |
|
256 |
+
| pearson_manhattan | 0.8492 |
|
257 |
+
| spearman_manhattan | 0.8451 |
|
258 |
+
| pearson_euclidean | 0.8494 |
|
259 |
+
| spearman_euclidean | 0.8449 |
|
260 |
+
| pearson_dot | 0.6924 |
|
261 |
+
| spearman_dot | 0.6794 |
|
262 |
+
| pearson_max | 0.8494 |
|
263 |
+
| spearman_max | 0.8456 |
|
264 |
+
|
265 |
+
<!--
|
266 |
+
## Bias, Risks and Limitations
|
267 |
+
|
268 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
269 |
+
-->
|
270 |
+
|
271 |
+
<!--
|
272 |
+
### Recommendations
|
273 |
+
|
274 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
275 |
+
-->
|
276 |
+
|
277 |
+
## Training Details
|
278 |
+
|
279 |
+
### Training Dataset
|
280 |
+
|
281 |
+
#### sentence-transformers/stsb
|
282 |
+
|
283 |
+
* Dataset: [sentence-transformers/stsb](https://huggingface.co/datasets/sentence-transformers/stsb) at [d999f12](https://huggingface.co/datasets/sentence-transformers/stsb/tree/d999f12281623b0925506817d9bd85e88289218a)
|
284 |
+
* Size: 5,749 training samples
|
285 |
+
* Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
|
286 |
+
* Approximate statistics based on the first 1000 samples:
|
287 |
+
| | sentence1 | sentence2 | score |
|
288 |
+
|:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------|
|
289 |
+
| type | string | string | float |
|
290 |
+
| details | <ul><li>min: 6 tokens</li><li>mean: 10.0 tokens</li><li>max: 28 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 9.95 tokens</li><li>max: 25 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.54</li><li>max: 1.0</li></ul> |
|
291 |
+
* Samples:
|
292 |
+
| sentence1 | sentence2 | score |
|
293 |
+
|:-----------------------------------------------------------|:----------------------------------------------------------------------|:------------------|
|
294 |
+
| <code>A plane is taking off.</code> | <code>An air plane is taking off.</code> | <code>1.0</code> |
|
295 |
+
| <code>A man is playing a large flute.</code> | <code>A man is playing a flute.</code> | <code>0.76</code> |
|
296 |
+
| <code>A man is spreading shreded cheese on a pizza.</code> | <code>A man is spreading shredded cheese on an uncooked pizza.</code> | <code>0.76</code> |
|
297 |
+
* Loss: [<code>AdaptiveLayerLoss</code>](https://sbert.net/docs/package_reference/losses.html#adaptivelayerloss) with these parameters:
|
298 |
+
```json
|
299 |
+
{
|
300 |
+
"loss": "CoSENTLoss",
|
301 |
+
"n_layers_per_step": 1,
|
302 |
+
"last_layer_weight": 1.0,
|
303 |
+
"prior_layers_weight": 1.0,
|
304 |
+
"kl_div_weight": 1.0,
|
305 |
+
"kl_temperature": 0.3
|
306 |
+
}
|
307 |
+
```
|
308 |
+
|
309 |
+
### Evaluation Dataset
|
310 |
+
|
311 |
+
#### sentence-transformers/stsb
|
312 |
+
|
313 |
+
* Dataset: [sentence-transformers/stsb](https://huggingface.co/datasets/sentence-transformers/stsb) at [d999f12](https://huggingface.co/datasets/sentence-transformers/stsb/tree/d999f12281623b0925506817d9bd85e88289218a)
|
314 |
+
* Size: 1,500 evaluation samples
|
315 |
+
* Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
|
316 |
+
* Approximate statistics based on the first 1000 samples:
|
317 |
+
| | sentence1 | sentence2 | score |
|
318 |
+
|:--------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
|
319 |
+
| type | string | string | float |
|
320 |
+
| details | <ul><li>min: 5 tokens</li><li>mean: 15.1 tokens</li><li>max: 45 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 15.11 tokens</li><li>max: 53 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.47</li><li>max: 1.0</li></ul> |
|
321 |
+
* Samples:
|
322 |
+
| sentence1 | sentence2 | score |
|
323 |
+
|:--------------------------------------------------|:------------------------------------------------------|:------------------|
|
324 |
+
| <code>A man with a hard hat is dancing.</code> | <code>A man wearing a hard hat is dancing.</code> | <code>1.0</code> |
|
325 |
+
| <code>A young child is riding a horse.</code> | <code>A child is riding a horse.</code> | <code>0.95</code> |
|
326 |
+
| <code>A man is feeding a mouse to a snake.</code> | <code>The man is feeding a mouse to the snake.</code> | <code>1.0</code> |
|
327 |
+
* Loss: [<code>AdaptiveLayerLoss</code>](https://sbert.net/docs/package_reference/losses.html#adaptivelayerloss) with these parameters:
|
328 |
+
```json
|
329 |
+
{
|
330 |
+
"loss": "CoSENTLoss",
|
331 |
+
"n_layers_per_step": 1,
|
332 |
+
"last_layer_weight": 1.0,
|
333 |
+
"prior_layers_weight": 1.0,
|
334 |
+
"kl_div_weight": 1.0,
|
335 |
+
"kl_temperature": 0.3
|
336 |
+
}
|
337 |
+
```
|
338 |
+
|
339 |
+
### Training Hyperparameters
|
340 |
+
#### Non-Default Hyperparameters
|
341 |
+
|
342 |
+
- `eval_strategy`: steps
|
343 |
+
- `per_device_train_batch_size`: 16
|
344 |
+
- `per_device_eval_batch_size`: 16
|
345 |
+
- `num_train_epochs`: 4
|
346 |
+
- `warmup_ratio`: 0.1
|
347 |
+
- `fp16`: True
|
348 |
+
|
349 |
+
#### All Hyperparameters
|
350 |
+
<details><summary>Click to expand</summary>
|
351 |
+
|
352 |
+
- `overwrite_output_dir`: False
|
353 |
+
- `do_predict`: False
|
354 |
+
- `eval_strategy`: steps
|
355 |
+
- `prediction_loss_only`: False
|
356 |
+
- `per_device_train_batch_size`: 16
|
357 |
+
- `per_device_eval_batch_size`: 16
|
358 |
+
- `per_gpu_train_batch_size`: None
|
359 |
+
- `per_gpu_eval_batch_size`: None
|
360 |
+
- `gradient_accumulation_steps`: 1
|
361 |
+
- `eval_accumulation_steps`: None
|
362 |
+
- `learning_rate`: 5e-05
|
363 |
+
- `weight_decay`: 0.0
|
364 |
+
- `adam_beta1`: 0.9
|
365 |
+
- `adam_beta2`: 0.999
|
366 |
+
- `adam_epsilon`: 1e-08
|
367 |
+
- `max_grad_norm`: 1.0
|
368 |
+
- `num_train_epochs`: 4
|
369 |
+
- `max_steps`: -1
|
370 |
+
- `lr_scheduler_type`: linear
|
371 |
+
- `lr_scheduler_kwargs`: {}
|
372 |
+
- `warmup_ratio`: 0.1
|
373 |
+
- `warmup_steps`: 0
|
374 |
+
- `log_level`: passive
|
375 |
+
- `log_level_replica`: warning
|
376 |
+
- `log_on_each_node`: True
|
377 |
+
- `logging_nan_inf_filter`: True
|
378 |
+
- `save_safetensors`: True
|
379 |
+
- `save_on_each_node`: False
|
380 |
+
- `save_only_model`: False
|
381 |
+
- `no_cuda`: False
|
382 |
+
- `use_cpu`: False
|
383 |
+
- `use_mps_device`: False
|
384 |
+
- `seed`: 42
|
385 |
+
- `data_seed`: None
|
386 |
+
- `jit_mode_eval`: False
|
387 |
+
- `use_ipex`: False
|
388 |
+
- `bf16`: False
|
389 |
+
- `fp16`: True
|
390 |
+
- `fp16_opt_level`: O1
|
391 |
+
- `half_precision_backend`: auto
|
392 |
+
- `bf16_full_eval`: False
|
393 |
+
- `fp16_full_eval`: False
|
394 |
+
- `tf32`: None
|
395 |
+
- `local_rank`: 0
|
396 |
+
- `ddp_backend`: None
|
397 |
+
- `tpu_num_cores`: None
|
398 |
+
- `tpu_metrics_debug`: False
|
399 |
+
- `debug`: []
|
400 |
+
- `dataloader_drop_last`: False
|
401 |
+
- `dataloader_num_workers`: 0
|
402 |
+
- `dataloader_prefetch_factor`: None
|
403 |
+
- `past_index`: -1
|
404 |
+
- `disable_tqdm`: False
|
405 |
+
- `remove_unused_columns`: True
|
406 |
+
- `label_names`: None
|
407 |
+
- `load_best_model_at_end`: False
|
408 |
+
- `ignore_data_skip`: False
|
409 |
+
- `fsdp`: []
|
410 |
+
- `fsdp_min_num_params`: 0
|
411 |
+
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
412 |
+
- `fsdp_transformer_layer_cls_to_wrap`: None
|
413 |
+
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
414 |
+
- `deepspeed`: None
|
415 |
+
- `label_smoothing_factor`: 0.0
|
416 |
+
- `optim`: adamw_torch
|
417 |
+
- `optim_args`: None
|
418 |
+
- `adafactor`: False
|
419 |
+
- `group_by_length`: False
|
420 |
+
- `length_column_name`: length
|
421 |
+
- `ddp_find_unused_parameters`: None
|
422 |
+
- `ddp_bucket_cap_mb`: None
|
423 |
+
- `ddp_broadcast_buffers`: None
|
424 |
+
- `dataloader_pin_memory`: True
|
425 |
+
- `dataloader_persistent_workers`: False
|
426 |
+
- `skip_memory_metrics`: True
|
427 |
+
- `use_legacy_prediction_loop`: False
|
428 |
+
- `push_to_hub`: False
|
429 |
+
- `resume_from_checkpoint`: None
|
430 |
+
- `hub_model_id`: None
|
431 |
+
- `hub_strategy`: every_save
|
432 |
+
- `hub_private_repo`: False
|
433 |
+
- `hub_always_push`: False
|
434 |
+
- `gradient_checkpointing`: False
|
435 |
+
- `gradient_checkpointing_kwargs`: None
|
436 |
+
- `include_inputs_for_metrics`: False
|
437 |
+
- `eval_do_concat_batches`: True
|
438 |
+
- `fp16_backend`: auto
|
439 |
+
- `push_to_hub_model_id`: None
|
440 |
+
- `push_to_hub_organization`: None
|
441 |
+
- `mp_parameters`:
|
442 |
+
- `auto_find_batch_size`: False
|
443 |
+
- `full_determinism`: False
|
444 |
+
- `torchdynamo`: None
|
445 |
+
- `ray_scope`: last
|
446 |
+
- `ddp_timeout`: 1800
|
447 |
+
- `torch_compile`: False
|
448 |
+
- `torch_compile_backend`: None
|
449 |
+
- `torch_compile_mode`: None
|
450 |
+
- `dispatch_batches`: None
|
451 |
+
- `split_batches`: None
|
452 |
+
- `include_tokens_per_second`: False
|
453 |
+
- `include_num_input_tokens_seen`: False
|
454 |
+
- `neftune_noise_alpha`: None
|
455 |
+
- `optim_target_modules`: None
|
456 |
+
- `batch_sampler`: batch_sampler
|
457 |
+
- `multi_dataset_batch_sampler`: proportional
|
458 |
+
|
459 |
+
</details>
|
460 |
+
|
461 |
+
### Training Logs
|
462 |
+
| Epoch | Step | Training Loss | loss | sts-dev_spearman_cosine | sts-test_spearman_cosine |
|
463 |
+
|:------:|:----:|:-------------:|:------:|:-----------------------:|:------------------------:|
|
464 |
+
| 0.2778 | 100 | 6.6822 | 6.2966 | 0.8433 | - |
|
465 |
+
| 0.5556 | 200 | 6.6943 | 6.6898 | 0.8450 | - |
|
466 |
+
| 0.8333 | 300 | 6.4234 | 6.7096 | 0.8555 | - |
|
467 |
+
| 1.1111 | 400 | 6.1543 | 6.6157 | 0.8590 | - |
|
468 |
+
| 1.3889 | 500 | 6.3869 | 6.4068 | 0.8596 | - |
|
469 |
+
| 1.6667 | 600 | 6.2925 | 6.4920 | 0.8597 | - |
|
470 |
+
| 1.9444 | 700 | 6.2973 | 6.3890 | 0.8658 | - |
|
471 |
+
| 2.2222 | 800 | 6.0865 | 6.8754 | 0.8683 | - |
|
472 |
+
| 2.5 | 900 | 5.6631 | 6.7812 | 0.8674 | - |
|
473 |
+
| 2.7778 | 1000 | 5.9954 | 6.8150 | 0.8684 | - |
|
474 |
+
| 3.0556 | 1100 | 5.6617 | 6.8462 | 0.8693 | - |
|
475 |
+
| 3.3333 | 1200 | 5.3529 | 7.2448 | 0.8702 | - |
|
476 |
+
| 3.6111 | 1300 | 5.3467 | 7.1615 | 0.8723 | - |
|
477 |
+
| 3.8889 | 1400 | 5.6536 | 7.3408 | 0.8728 | - |
|
478 |
+
| 4.0 | 1440 | - | - | - | 0.8456 |
|
479 |
+
|
480 |
+
|
481 |
+
### Environmental Impact
|
482 |
+
Carbon emissions were measured using [CodeCarbon](https://github.com/mlco2/codecarbon).
|
483 |
+
- **Energy Consumed**: 0.013 kWh
|
484 |
+
- **Carbon Emitted**: 0.005 kg of CO2
|
485 |
+
- **Hours Used**: 0.069 hours
|
486 |
+
|
487 |
+
### Training Hardware
|
488 |
+
- **On Cloud**: No
|
489 |
+
- **GPU Model**: 1 x NVIDIA GeForce RTX 3090
|
490 |
+
- **CPU Model**: 13th Gen Intel(R) Core(TM) i7-13700K
|
491 |
+
- **RAM Size**: 31.78 GB
|
492 |
+
|
493 |
+
### Framework Versions
|
494 |
+
- Python: 3.11.6
|
495 |
+
- Sentence Transformers: 3.0.0.dev0
|
496 |
+
- Transformers: 4.41.0.dev0
|
497 |
+
- PyTorch: 2.3.0+cu121
|
498 |
+
- Accelerate: 0.26.1
|
499 |
+
- Datasets: 2.18.0
|
500 |
+
- Tokenizers: 0.19.1
|
501 |
+
|
502 |
+
## Citation
|
503 |
+
|
504 |
+
### BibTeX
|
505 |
+
|
506 |
+
#### Sentence Transformers
|
507 |
+
```bibtex
|
508 |
+
@inproceedings{reimers-2019-sentence-bert,
|
509 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
510 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
511 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
512 |
+
month = "11",
|
513 |
+
year = "2019",
|
514 |
+
publisher = "Association for Computational Linguistics",
|
515 |
+
url = "https://arxiv.org/abs/1908.10084",
|
516 |
+
}
|
517 |
+
```
|
518 |
+
|
519 |
+
#### AdaptiveLayerLoss
|
520 |
+
```bibtex
|
521 |
+
@misc{li20242d,
|
522 |
+
title={2D Matryoshka Sentence Embeddings},
|
523 |
+
author={Xianming Li and Zongxi Li and Jing Li and Haoran Xie and Qing Li},
|
524 |
+
year={2024},
|
525 |
+
eprint={2402.14776},
|
526 |
+
archivePrefix={arXiv},
|
527 |
+
primaryClass={cs.CL}
|
528 |
+
}
|
529 |
+
```
|
530 |
+
|
531 |
+
#### CoSENTLoss
|
532 |
+
```bibtex
|
533 |
+
@online{kexuefm-8847,
|
534 |
+
title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
|
535 |
+
author={Su Jianlin},
|
536 |
+
year={2022},
|
537 |
+
month={Jan},
|
538 |
+
url={https://kexue.fm/archives/8847},
|
539 |
+
}
|
540 |
+
```
|
541 |
+
|
542 |
+
<!--
|
543 |
+
## Glossary
|
544 |
+
|
545 |
+
*Clearly define terms in order to be accessible across audiences.*
|
546 |
+
-->
|
547 |
+
|
548 |
+
<!--
|
549 |
+
## Model Card Authors
|
550 |
+
|
551 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
552 |
+
-->
|
553 |
+
|
554 |
+
<!--
|
555 |
+
## Model Card Contact
|
556 |
+
|
557 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
558 |
+
-->
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "output/adaptive_layer_sts_distilbert-base-uncased-2024-04-25_17-28-18/final",
|
3 |
+
"activation": "gelu",
|
4 |
+
"architectures": [
|
5 |
+
"DistilBertModel"
|
6 |
+
],
|
7 |
+
"attention_dropout": 0.1,
|
8 |
+
"dim": 768,
|
9 |
+
"dropout": 0.1,
|
10 |
+
"hidden_dim": 3072,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"max_position_embeddings": 512,
|
13 |
+
"model_type": "distilbert",
|
14 |
+
"n_heads": 12,
|
15 |
+
"n_layers": 6,
|
16 |
+
"pad_token_id": 0,
|
17 |
+
"qa_dropout": 0.1,
|
18 |
+
"seq_classif_dropout": 0.2,
|
19 |
+
"sinusoidal_pos_embds": false,
|
20 |
+
"tie_weights_": true,
|
21 |
+
"torch_dtype": "float32",
|
22 |
+
"transformers_version": "4.41.0.dev0",
|
23 |
+
"vocab_size": 30522
|
24 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "3.0.0.dev0",
|
4 |
+
"transformers": "4.41.0.dev0",
|
5 |
+
"pytorch": "2.3.0+cu121"
|
6 |
+
},
|
7 |
+
"prompts": {},
|
8 |
+
"default_prompt_name": null,
|
9 |
+
"similarity_fn_name": null
|
10 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0f8eac6c58507a0d2d74b2e5d8274b3da302f3caf67d192a2c9265732c0a62bc
|
3 |
+
size 265462608
|
modules.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"idx": 0,
|
4 |
+
"name": "0",
|
5 |
+
"path": "",
|
6 |
+
"type": "sentence_transformers.models.Transformer"
|
7 |
+
},
|
8 |
+
{
|
9 |
+
"idx": 1,
|
10 |
+
"name": "1",
|
11 |
+
"path": "1_Pooling",
|
12 |
+
"type": "sentence_transformers.models.Pooling"
|
13 |
+
}
|
14 |
+
]
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 512,
|
3 |
+
"do_lower_case": false
|
4 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": {
|
3 |
+
"content": "[CLS]",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"mask_token": {
|
10 |
+
"content": "[MASK]",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "[PAD]",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"sep_token": {
|
24 |
+
"content": "[SEP]",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"unk_token": {
|
31 |
+
"content": "[UNK]",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false
|
36 |
+
}
|
37 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "[PAD]",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"100": {
|
12 |
+
"content": "[UNK]",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"101": {
|
20 |
+
"content": "[CLS]",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"102": {
|
28 |
+
"content": "[SEP]",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"103": {
|
36 |
+
"content": "[MASK]",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"clean_up_tokenization_spaces": true,
|
45 |
+
"cls_token": "[CLS]",
|
46 |
+
"do_lower_case": true,
|
47 |
+
"mask_token": "[MASK]",
|
48 |
+
"max_length": 512,
|
49 |
+
"model_max_length": 512,
|
50 |
+
"pad_to_multiple_of": null,
|
51 |
+
"pad_token": "[PAD]",
|
52 |
+
"pad_token_type_id": 0,
|
53 |
+
"padding_side": "right",
|
54 |
+
"sep_token": "[SEP]",
|
55 |
+
"stride": 0,
|
56 |
+
"strip_accents": null,
|
57 |
+
"tokenize_chinese_chars": true,
|
58 |
+
"tokenizer_class": "DistilBertTokenizer",
|
59 |
+
"truncation_side": "right",
|
60 |
+
"truncation_strategy": "longest_first",
|
61 |
+
"unk_token": "[UNK]"
|
62 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|