KiViDrag commited on
Commit
b2eefc1
·
verified ·
1 Parent(s): e6689de

Add new SentenceTransformer model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": true,
4
+ "pooling_mode_mean_tokens": false,
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,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - generated_from_trainer
7
+ - dataset_size:16000
8
+ - loss:DenoisingAutoEncoderLoss
9
+ base_model: google-bert/bert-base-uncased
10
+ widget:
11
+ - source_sentence: can so hopeless to who cares
12
+ sentences:
13
+ - id done that though it kind of did a on me and i found myself sympathizing with
14
+ the demons as the church called them and feeling more disgusted with the people
15
+ who were supposed to be trying to fight them off
16
+ - i can go from feeling so hopeless to so damned hopeful just from being around
17
+ someone who cares and is awake
18
+ - i feel quite honored to exhibit my work in portugal especially within the critical
19
+ and philosophical context of the god factor project said west
20
+ - source_sentence: im feeling regretful not back i exact things you i would also to
21
+ you letters
22
+ sentences:
23
+ - i feel like people dont really want me in their company but also they dont want
24
+ to hurt my feelings
25
+ - i continue to succeed in something and having someone seems unattainable because
26
+ i feel men will be intimidated or when there is a prolonged moment of silence
27
+ - im feeling regretful about not writing back to you i felt the exact same things
28
+ you did and i would have also loved to have you read my letters
29
+ - source_sentence: feel there not because or gary feel i moving them
30
+ sentences:
31
+ - i feel so unwelcome there but not because of her or gary i just feel that i shouldnt
32
+ be moving back in with them
33
+ - i dont know why but every time i feel like i am doing someone a favor all the
34
+ time i start to feel burdened and stressed by that
35
+ - id have spent more time with her on reading i feel a bit guilty about that
36
+ - source_sentence: came diy twiggy holder feeling all and
37
+ sentences:
38
+ - i watch movies set in the s and s i feel pangs of melancholy
39
+ - i came across this picture of a diy twiggy candle holder and now im feeling all
40
+ festive and creative
41
+ - i read other peoples posts there are moments where i feel id give my left fingernail
42
+ to be them my left fingernail is precious because its the only one i can polish
43
+ perfectly out of the
44
+ - source_sentence: i missed precious summer
45
+ sentences:
46
+ - i feel so frightened i just wanted to document the way i m feeling
47
+ - i really feel like i have a lot to offer in this area i would like to focus on
48
+ troubled teenagers
49
+ - i feel like i missed most of my precious summer
50
+ pipeline_tag: sentence-similarity
51
+ library_name: sentence-transformers
52
+ ---
53
+
54
+ # SentenceTransformer based on google-bert/bert-base-uncased
55
+
56
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [google-bert/bert-base-uncased](https://huggingface.co/google-bert/bert-base-uncased). 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.
57
+
58
+ ## Model Details
59
+
60
+ ### Model Description
61
+ - **Model Type:** Sentence Transformer
62
+ - **Base model:** [google-bert/bert-base-uncased](https://huggingface.co/google-bert/bert-base-uncased) <!-- at revision 86b5e0934494bd15c9632b12f734a8a67f723594 -->
63
+ - **Maximum Sequence Length:** 512 tokens
64
+ - **Output Dimensionality:** 768 dimensions
65
+ - **Similarity Function:** Cosine Similarity
66
+ <!-- - **Training Dataset:** Unknown -->
67
+ <!-- - **Language:** Unknown -->
68
+ <!-- - **License:** Unknown -->
69
+
70
+ ### Model Sources
71
+
72
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
73
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
74
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
75
+
76
+ ### Full Model Architecture
77
+
78
+ ```
79
+ SentenceTransformer(
80
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
81
+ (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
82
+ )
83
+ ```
84
+
85
+ ## Usage
86
+
87
+ ### Direct Usage (Sentence Transformers)
88
+
89
+ First install the Sentence Transformers library:
90
+
91
+ ```bash
92
+ pip install -U sentence-transformers
93
+ ```
94
+
95
+ Then you can load this model and run inference.
96
+ ```python
97
+ from sentence_transformers import SentenceTransformer
98
+
99
+ # Download from the 🤗 Hub
100
+ model = SentenceTransformer("KiViDrag/pretrain_emotion2")
101
+ # Run inference
102
+ sentences = [
103
+ 'i missed precious summer',
104
+ 'i feel like i missed most of my precious summer',
105
+ 'i feel so frightened i just wanted to document the way i m feeling',
106
+ ]
107
+ embeddings = model.encode(sentences)
108
+ print(embeddings.shape)
109
+ # [3, 768]
110
+
111
+ # Get the similarity scores for the embeddings
112
+ similarities = model.similarity(embeddings, embeddings)
113
+ print(similarities.shape)
114
+ # [3, 3]
115
+ ```
116
+
117
+ <!--
118
+ ### Direct Usage (Transformers)
119
+
120
+ <details><summary>Click to see the direct usage in Transformers</summary>
121
+
122
+ </details>
123
+ -->
124
+
125
+ <!--
126
+ ### Downstream Usage (Sentence Transformers)
127
+
128
+ You can finetune this model on your own dataset.
129
+
130
+ <details><summary>Click to expand</summary>
131
+
132
+ </details>
133
+ -->
134
+
135
+ <!--
136
+ ### Out-of-Scope Use
137
+
138
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
139
+ -->
140
+
141
+ <!--
142
+ ## Bias, Risks and Limitations
143
+
144
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
145
+ -->
146
+
147
+ <!--
148
+ ### Recommendations
149
+
150
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
151
+ -->
152
+
153
+ ## Training Details
154
+
155
+ ### Training Dataset
156
+
157
+ #### Unnamed Dataset
158
+
159
+ * Size: 16,000 training samples
160
+ * Columns: <code>sentence_0</code> and <code>sentence_1</code>
161
+ * Approximate statistics based on the first 1000 samples:
162
+ | | sentence_0 | sentence_1 |
163
+ |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
164
+ | type | string | string |
165
+ | details | <ul><li>min: 3 tokens</li><li>mean: 10.02 tokens</li><li>max: 36 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 22.09 tokens</li><li>max: 72 tokens</li></ul> |
166
+ * Samples:
167
+ | sentence_0 | sentence_1 |
168
+ |:---------------------------------------------------|:--------------------------------------------------------------------------------------------------------|
169
+ | <code>i</code> | <code>i like to slump into when i m feeling precious</code> |
170
+ | <code>i say make anyone feel reaching their</code> | <code>i could say that will make anyone feel better than actually reaching their goal themselves</code> |
171
+ | <code>wont</code> | <code>i wont feel so damn idiotic</code> |
172
+ * Loss: [<code>DenoisingAutoEncoderLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#denoisingautoencoderloss)
173
+
174
+ ### Training Hyperparameters
175
+ #### Non-Default Hyperparameters
176
+
177
+ - `per_device_train_batch_size`: 64
178
+ - `per_device_eval_batch_size`: 64
179
+ - `num_train_epochs`: 9
180
+ - `multi_dataset_batch_sampler`: round_robin
181
+
182
+ #### All Hyperparameters
183
+ <details><summary>Click to expand</summary>
184
+
185
+ - `overwrite_output_dir`: False
186
+ - `do_predict`: False
187
+ - `eval_strategy`: no
188
+ - `prediction_loss_only`: True
189
+ - `per_device_train_batch_size`: 64
190
+ - `per_device_eval_batch_size`: 64
191
+ - `per_gpu_train_batch_size`: None
192
+ - `per_gpu_eval_batch_size`: None
193
+ - `gradient_accumulation_steps`: 1
194
+ - `eval_accumulation_steps`: None
195
+ - `torch_empty_cache_steps`: None
196
+ - `learning_rate`: 5e-05
197
+ - `weight_decay`: 0.0
198
+ - `adam_beta1`: 0.9
199
+ - `adam_beta2`: 0.999
200
+ - `adam_epsilon`: 1e-08
201
+ - `max_grad_norm`: 1
202
+ - `num_train_epochs`: 9
203
+ - `max_steps`: -1
204
+ - `lr_scheduler_type`: linear
205
+ - `lr_scheduler_kwargs`: {}
206
+ - `warmup_ratio`: 0.0
207
+ - `warmup_steps`: 0
208
+ - `log_level`: passive
209
+ - `log_level_replica`: warning
210
+ - `log_on_each_node`: True
211
+ - `logging_nan_inf_filter`: True
212
+ - `save_safetensors`: True
213
+ - `save_on_each_node`: False
214
+ - `save_only_model`: False
215
+ - `restore_callback_states_from_checkpoint`: False
216
+ - `no_cuda`: False
217
+ - `use_cpu`: False
218
+ - `use_mps_device`: False
219
+ - `seed`: 42
220
+ - `data_seed`: None
221
+ - `jit_mode_eval`: False
222
+ - `use_ipex`: False
223
+ - `bf16`: False
224
+ - `fp16`: False
225
+ - `fp16_opt_level`: O1
226
+ - `half_precision_backend`: auto
227
+ - `bf16_full_eval`: False
228
+ - `fp16_full_eval`: False
229
+ - `tf32`: None
230
+ - `local_rank`: 0
231
+ - `ddp_backend`: None
232
+ - `tpu_num_cores`: None
233
+ - `tpu_metrics_debug`: False
234
+ - `debug`: []
235
+ - `dataloader_drop_last`: False
236
+ - `dataloader_num_workers`: 0
237
+ - `dataloader_prefetch_factor`: None
238
+ - `past_index`: -1
239
+ - `disable_tqdm`: False
240
+ - `remove_unused_columns`: True
241
+ - `label_names`: None
242
+ - `load_best_model_at_end`: False
243
+ - `ignore_data_skip`: False
244
+ - `fsdp`: []
245
+ - `fsdp_min_num_params`: 0
246
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
247
+ - `tp_size`: 0
248
+ - `fsdp_transformer_layer_cls_to_wrap`: None
249
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
250
+ - `deepspeed`: None
251
+ - `label_smoothing_factor`: 0.0
252
+ - `optim`: adamw_torch
253
+ - `optim_args`: None
254
+ - `adafactor`: False
255
+ - `group_by_length`: False
256
+ - `length_column_name`: length
257
+ - `ddp_find_unused_parameters`: None
258
+ - `ddp_bucket_cap_mb`: None
259
+ - `ddp_broadcast_buffers`: False
260
+ - `dataloader_pin_memory`: True
261
+ - `dataloader_persistent_workers`: False
262
+ - `skip_memory_metrics`: True
263
+ - `use_legacy_prediction_loop`: False
264
+ - `push_to_hub`: False
265
+ - `resume_from_checkpoint`: None
266
+ - `hub_model_id`: None
267
+ - `hub_strategy`: every_save
268
+ - `hub_private_repo`: None
269
+ - `hub_always_push`: False
270
+ - `gradient_checkpointing`: False
271
+ - `gradient_checkpointing_kwargs`: None
272
+ - `include_inputs_for_metrics`: False
273
+ - `include_for_metrics`: []
274
+ - `eval_do_concat_batches`: True
275
+ - `fp16_backend`: auto
276
+ - `push_to_hub_model_id`: None
277
+ - `push_to_hub_organization`: None
278
+ - `mp_parameters`:
279
+ - `auto_find_batch_size`: False
280
+ - `full_determinism`: False
281
+ - `torchdynamo`: None
282
+ - `ray_scope`: last
283
+ - `ddp_timeout`: 1800
284
+ - `torch_compile`: False
285
+ - `torch_compile_backend`: None
286
+ - `torch_compile_mode`: None
287
+ - `dispatch_batches`: None
288
+ - `split_batches`: None
289
+ - `include_tokens_per_second`: False
290
+ - `include_num_input_tokens_seen`: False
291
+ - `neftune_noise_alpha`: None
292
+ - `optim_target_modules`: None
293
+ - `batch_eval_metrics`: False
294
+ - `eval_on_start`: False
295
+ - `use_liger_kernel`: False
296
+ - `eval_use_gather_object`: False
297
+ - `average_tokens_across_devices`: False
298
+ - `prompts`: None
299
+ - `batch_sampler`: batch_sampler
300
+ - `multi_dataset_batch_sampler`: round_robin
301
+
302
+ </details>
303
+
304
+ ### Training Logs
305
+ | Epoch | Step | Training Loss |
306
+ |:-----:|:----:|:-------------:|
307
+ | 2.0 | 500 | 4.3707 |
308
+ | 4.0 | 1000 | 3.3926 |
309
+ | 6.0 | 1500 | 2.7636 |
310
+ | 8.0 | 2000 | 2.1161 |
311
+
312
+
313
+ ### Framework Versions
314
+ - Python: 3.11.11
315
+ - Sentence Transformers: 3.4.1
316
+ - Transformers: 4.50.3
317
+ - PyTorch: 2.6.0+cu124
318
+ - Accelerate: 1.5.2
319
+ - Datasets: 3.5.0
320
+ - Tokenizers: 0.21.1
321
+
322
+ ## Citation
323
+
324
+ ### BibTeX
325
+
326
+ #### Sentence Transformers
327
+ ```bibtex
328
+ @inproceedings{reimers-2019-sentence-bert,
329
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
330
+ author = "Reimers, Nils and Gurevych, Iryna",
331
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
332
+ month = "11",
333
+ year = "2019",
334
+ publisher = "Association for Computational Linguistics",
335
+ url = "https://arxiv.org/abs/1908.10084",
336
+ }
337
+ ```
338
+
339
+ #### DenoisingAutoEncoderLoss
340
+ ```bibtex
341
+ @inproceedings{wang-2021-TSDAE,
342
+ title = "TSDAE: Using Transformer-based Sequential Denoising Auto-Encoderfor Unsupervised Sentence Embedding Learning",
343
+ author = "Wang, Kexin and Reimers, Nils and Gurevych, Iryna",
344
+ booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
345
+ month = nov,
346
+ year = "2021",
347
+ address = "Punta Cana, Dominican Republic",
348
+ publisher = "Association for Computational Linguistics",
349
+ pages = "671--688",
350
+ url = "https://arxiv.org/abs/2104.06979",
351
+ }
352
+ ```
353
+
354
+ <!--
355
+ ## Glossary
356
+
357
+ *Clearly define terms in order to be accessible across audiences.*
358
+ -->
359
+
360
+ <!--
361
+ ## Model Card Authors
362
+
363
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
364
+ -->
365
+
366
+ <!--
367
+ ## Model Card Contact
368
+
369
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
370
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 768,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 3072,
13
+ "layer_norm_eps": 1e-12,
14
+ "max_position_embeddings": 512,
15
+ "model_type": "bert",
16
+ "num_attention_heads": 12,
17
+ "num_hidden_layers": 12,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.50.3",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.4.1",
4
+ "transformers": "4.50.3",
5
+ "pytorch": "2.6.0+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:697ab9ddcf12cab266943b3e2494a032de4867aa2f47044e641036250bd7105b
3
+ size 437951328
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,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "BertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff