razsarusi commited on
Commit
f5c69ac
·
verified ·
1 Parent(s): 5a2fb74

Add new SentenceTransformer model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "embedding_dimension": 768,
3
+ "pooling_mode": "mean",
4
+ "include_prompt": true
5
+ }
README.md ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - generated_from_trainer
7
+ - dataset_size:2400
8
+ - loss:MultipleNegativesRankingLoss
9
+ base_model: sentence-transformers/all-mpnet-base-v2
10
+ widget:
11
+ - source_sentence: 'Mind over matter: A dreamer learns to bend reality for personal
12
+ gain.'
13
+ sentences:
14
+ - A former bounty hunter takes up arms again to hunt down the outlaw responsible
15
+ for the death of her daughter.
16
+ - A woman becomes obsessed with finding proof of her husband's infidelity, leading
17
+ her on a dark quest through haunted landscapes.
18
+ - A dreamer becomes convinced that reality bends to his will, leading him on a quest
19
+ to understand how he can control the fabric of our waking existence, at any cost.
20
+ - source_sentence: Two lonely souls meet at a wild nightclub; soon, they're changed
21
+ forever by chance encounters.
22
+ sentences:
23
+ - A team searches for the last remnants of a lost colony on Mars before humanity
24
+ can fully commit to colonization.
25
+ - A journalist uncovers secrets behind the veil of clean cuts in the fashion industry.
26
+ - Two strangers cross paths in a chaotic club during a night of partying and chaos
27
+ – neither wants the other’s company, yet together, their lives begin to change
28
+ in surprising ways.
29
+ - source_sentence: Survivor on isolated island listens to eerie ocean whispers for
30
+ survival clues.
31
+ sentences:
32
+ - On a deserted island, a survivor listens to the ocean whispering its fears and
33
+ desires, trying to decipher how to survive.
34
+ - An archaeologist uncovers an ancient artifact that reveals secrets about his lost
35
+ love, but must navigate forbidden knowledge and supernatural forces.
36
+ - During a beach vacation in Greece, a trio of tourists discover an ancient artifact
37
+ that unleashes a deadly underwater force.
38
+ - source_sentence: Jazz club owner fights for survival while reconnecting with his
39
+ love amidst war-torn NYC.
40
+ sentences:
41
+ - With the Earth at risk of extinction due to technology gone awry, a man uses his
42
+ last strength to protect his daughter.
43
+ - As two sisters navigate their parents' inheritance dispute over an estate they
44
+ love, they uncover secrets hidden beneath a family feud.
45
+ - As a jazz club owner struggles to stay open in a post-apocalyptic world ravaged
46
+ by war, a passionate saxophonist reconnects with a love interest he couldn't save.
47
+ - source_sentence: Boy discovers treasure map in attic, embarks on grand adventure
48
+ to find lost kingdoms.
49
+ sentences:
50
+ - A boy finds an ancient map to a legendary kingdom hidden in his grandfather's
51
+ attic, leading him on a quest to reunite lost treasures.
52
+ - After uncovering a secret society of vampires, young Jake must battle supernatural
53
+ forces while rescuing his dying mother.
54
+ - Private investigator Leo Stone faces corruption within his own agency when a high-profile
55
+ murder case spirals out of control.
56
+ pipeline_tag: sentence-similarity
57
+ library_name: sentence-transformers
58
+ ---
59
+
60
+ # SentenceTransformer based on sentence-transformers/all-mpnet-base-v2
61
+
62
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.
63
+
64
+ ## Model Details
65
+
66
+ ### Model Description
67
+ - **Model Type:** Sentence Transformer
68
+ - **Base model:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) <!-- at revision e8c3b32edf5434bc2275fc9bab85f82640a19130 -->
69
+ - **Maximum Sequence Length:** 384 tokens
70
+ - **Output Dimensionality:** 768 dimensions
71
+ - **Similarity Function:** Cosine Similarity
72
+ - **Supported Modality:** Text
73
+ <!-- - **Training Dataset:** Unknown -->
74
+ <!-- - **Language:** Unknown -->
75
+ <!-- - **License:** Unknown -->
76
+
77
+ ### Model Sources
78
+
79
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
80
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
81
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
82
+
83
+ ### Full Model Architecture
84
+
85
+ ```
86
+ SentenceTransformer(
87
+ (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'MPNetModel'})
88
+ (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
89
+ (2): Normalize({})
90
+ )
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ ### Direct Usage (Sentence Transformers)
96
+
97
+ First install the Sentence Transformers library:
98
+
99
+ ```bash
100
+ pip install -U sentence-transformers
101
+ ```
102
+ Then you can load this model and run inference.
103
+ ```python
104
+ from sentence_transformers import SentenceTransformer
105
+
106
+ # Download from the 🤗 Hub
107
+ model = SentenceTransformer("razsarusi/plottwist-embedder-ft")
108
+ # Run inference
109
+ sentences = [
110
+ 'Boy discovers treasure map in attic, embarks on grand adventure to find lost kingdoms.',
111
+ "A boy finds an ancient map to a legendary kingdom hidden in his grandfather's attic, leading him on a quest to reunite lost treasures.",
112
+ 'Private investigator Leo Stone faces corruption within his own agency when a high-profile murder case spirals out of control.',
113
+ ]
114
+ embeddings = model.encode(sentences)
115
+ print(embeddings.shape)
116
+ # [3, 768]
117
+
118
+ # Get the similarity scores for the embeddings
119
+ similarities = model.similarity(embeddings, embeddings)
120
+ print(similarities)
121
+ # tensor([[ 1.0000, 0.8125, -0.0376],
122
+ # [ 0.8125, 1.0000, -0.0777],
123
+ # [-0.0376, -0.0777, 1.0000]])
124
+ ```
125
+ <!--
126
+ ### Direct Usage (Transformers)
127
+
128
+ <details><summary>Click to see the direct usage in Transformers</summary>
129
+
130
+ </details>
131
+ -->
132
+
133
+ <!--
134
+ ### Downstream Usage (Sentence Transformers)
135
+
136
+ You can finetune this model on your own dataset.
137
+
138
+ <details><summary>Click to expand</summary>
139
+
140
+ </details>
141
+ -->
142
+
143
+ <!--
144
+ ### Out-of-Scope Use
145
+
146
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
147
+ -->
148
+
149
+ <!--
150
+ ## Bias, Risks and Limitations
151
+
152
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
153
+ -->
154
+
155
+ <!--
156
+ ### Recommendations
157
+
158
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
159
+ -->
160
+
161
+ ## Training Details
162
+
163
+ ### Training Dataset
164
+
165
+ #### Unnamed Dataset
166
+
167
+ * Size: 2,400 training samples
168
+ * Columns: <code>sentence_0</code> and <code>sentence_1</code>
169
+ * Approximate statistics based on the first 100 samples:
170
+ | | sentence_0 | sentence_1 |
171
+ |:---------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
172
+ | type | string | string |
173
+ | modality | text | text |
174
+ | details | <ul><li>min: 11 tokens</li><li>mean: 16.69 tokens</li><li>max: 32 tokens</li></ul> | <ul><li>min: 18 tokens</li><li>mean: 28.94 tokens</li><li>max: 48 tokens</li></ul> |
175
+ * Samples:
176
+ | sentence_0 | sentence_1 |
177
+ |:-------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
178
+ | <code>Librarian uncovers dark secrets at ancient library, battling killers in frigid winter.</code> | <code>A local librarian finds herself drawn into a web of cold blooded murders as she investigates a cursed library in the heart of winter, hoping to keep her community safe.</code> |
179
+ | <code>Dystopian tech dreams rewrite history's past, causing global chaos; only those with ancient wisdom know how to reverse their dark manipulation.</code> | <code>In a dystopian future, dream manipulators attempt to rewrite history, leading to catastrophic consequences only they can fix, using a technique deemed too advanced for society.</code> |
180
+ | <code>Two travelers find love while the world burns; can they survive the endless darkness?</code> | <code>Two strangers fall in love across three continents under the shadow of impending doom, but their bond will be tested when the night never ends.</code> |
181
+ * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
182
+ ```json
183
+ {
184
+ "scale": 20.0,
185
+ "similarity_fct": "cos_sim",
186
+ "gather_across_devices": false,
187
+ "directions": [
188
+ "query_to_doc"
189
+ ],
190
+ "partition_mode": "joint",
191
+ "hardness_mode": null,
192
+ "hardness_strength": 0.0
193
+ }
194
+ ```
195
+
196
+ ### Training Hyperparameters
197
+ #### Non-Default Hyperparameters
198
+
199
+ - `per_device_train_batch_size`: 32
200
+ - `num_train_epochs`: 2
201
+ - `per_device_eval_batch_size`: 32
202
+ - `multi_dataset_batch_sampler`: round_robin
203
+
204
+ #### All Hyperparameters
205
+ <details><summary>Click to expand</summary>
206
+
207
+ - `per_device_train_batch_size`: 32
208
+ - `num_train_epochs`: 2
209
+ - `max_steps`: -1
210
+ - `learning_rate`: 5e-05
211
+ - `lr_scheduler_type`: linear
212
+ - `lr_scheduler_kwargs`: None
213
+ - `warmup_steps`: 0
214
+ - `optim`: adamw_torch_fused
215
+ - `optim_args`: None
216
+ - `weight_decay`: 0.0
217
+ - `adam_beta1`: 0.9
218
+ - `adam_beta2`: 0.999
219
+ - `adam_epsilon`: 1e-08
220
+ - `optim_target_modules`: None
221
+ - `gradient_accumulation_steps`: 1
222
+ - `average_tokens_across_devices`: True
223
+ - `max_grad_norm`: 1
224
+ - `label_smoothing_factor`: 0.0
225
+ - `bf16`: False
226
+ - `fp16`: False
227
+ - `bf16_full_eval`: False
228
+ - `fp16_full_eval`: False
229
+ - `tf32`: None
230
+ - `gradient_checkpointing`: False
231
+ - `gradient_checkpointing_kwargs`: None
232
+ - `torch_compile`: False
233
+ - `torch_compile_backend`: None
234
+ - `torch_compile_mode`: None
235
+ - `use_liger_kernel`: False
236
+ - `liger_kernel_config`: None
237
+ - `use_cache`: False
238
+ - `neftune_noise_alpha`: None
239
+ - `torch_empty_cache_steps`: None
240
+ - `auto_find_batch_size`: False
241
+ - `log_on_each_node`: True
242
+ - `logging_nan_inf_filter`: True
243
+ - `include_num_input_tokens_seen`: no
244
+ - `log_level`: passive
245
+ - `log_level_replica`: warning
246
+ - `disable_tqdm`: False
247
+ - `project`: huggingface
248
+ - `trackio_space_id`: None
249
+ - `trackio_bucket_id`: None
250
+ - `trackio_static_space_id`: None
251
+ - `per_device_eval_batch_size`: 32
252
+ - `prediction_loss_only`: True
253
+ - `eval_on_start`: False
254
+ - `eval_do_concat_batches`: True
255
+ - `eval_use_gather_object`: False
256
+ - `eval_accumulation_steps`: None
257
+ - `include_for_metrics`: []
258
+ - `batch_eval_metrics`: False
259
+ - `save_only_model`: False
260
+ - `save_on_each_node`: False
261
+ - `enable_jit_checkpoint`: False
262
+ - `push_to_hub`: False
263
+ - `hub_private_repo`: None
264
+ - `hub_model_id`: None
265
+ - `hub_strategy`: every_save
266
+ - `hub_always_push`: False
267
+ - `hub_revision`: None
268
+ - `load_best_model_at_end`: False
269
+ - `ignore_data_skip`: False
270
+ - `restore_callback_states_from_checkpoint`: False
271
+ - `full_determinism`: False
272
+ - `seed`: 42
273
+ - `data_seed`: None
274
+ - `use_cpu`: False
275
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
276
+ - `parallelism_config`: None
277
+ - `dataloader_drop_last`: False
278
+ - `dataloader_num_workers`: 0
279
+ - `dataloader_pin_memory`: True
280
+ - `dataloader_persistent_workers`: False
281
+ - `dataloader_prefetch_factor`: None
282
+ - `remove_unused_columns`: True
283
+ - `label_names`: None
284
+ - `train_sampling_strategy`: random
285
+ - `length_column_name`: length
286
+ - `ddp_find_unused_parameters`: None
287
+ - `ddp_bucket_cap_mb`: None
288
+ - `ddp_broadcast_buffers`: False
289
+ - `ddp_static_graph`: None
290
+ - `ddp_backend`: None
291
+ - `ddp_timeout`: 1800
292
+ - `fsdp`: None
293
+ - `fsdp_config`: None
294
+ - `deepspeed`: None
295
+ - `debug`: []
296
+ - `skip_memory_metrics`: True
297
+ - `do_predict`: False
298
+ - `resume_from_checkpoint`: None
299
+ - `warmup_ratio`: None
300
+ - `local_rank`: -1
301
+ - `prompts`: None
302
+ - `batch_sampler`: batch_sampler
303
+ - `multi_dataset_batch_sampler`: round_robin
304
+ - `router_mapping`: {}
305
+ - `learning_rate_mapping`: {}
306
+
307
+ </details>
308
+
309
+ ### Training Time
310
+ - **Training**: 1.9 minutes
311
+
312
+ ### Framework Versions
313
+ - Python: 3.12.13
314
+ - Sentence Transformers: 5.6.0
315
+ - Transformers: 5.13.1
316
+ - PyTorch: 2.11.0+cu128
317
+ - Accelerate: 1.14.0
318
+ - Datasets: 4.0.0
319
+ - Tokenizers: 0.22.2
320
+
321
+ ## Citation
322
+
323
+ ### BibTeX
324
+
325
+ #### Sentence Transformers
326
+ ```bibtex
327
+ @inproceedings{reimers-2019-sentence-bert,
328
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
329
+ author = "Reimers, Nils and Gurevych, Iryna",
330
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
331
+ month = "11",
332
+ year = "2019",
333
+ publisher = "Association for Computational Linguistics",
334
+ url = "https://arxiv.org/abs/1908.10084",
335
+ }
336
+ ```
337
+
338
+ #### MultipleNegativesRankingLoss
339
+ ```bibtex
340
+ @misc{oord2019representationlearningcontrastivepredictive,
341
+ title={Representation Learning with Contrastive Predictive Coding},
342
+ author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
343
+ year={2019},
344
+ eprint={1807.03748},
345
+ archivePrefix={arXiv},
346
+ primaryClass={cs.LG},
347
+ url={https://arxiv.org/abs/1807.03748},
348
+ }
349
+ ```
350
+
351
+ <!--
352
+ ## Glossary
353
+
354
+ *Clearly define terms in order to be accessible across audiences.*
355
+ -->
356
+
357
+ <!--
358
+ ## Model Card Authors
359
+
360
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
361
+ -->
362
+
363
+ <!--
364
+ ## Model Card Contact
365
+
366
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
367
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MPNetModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "dtype": "float32",
8
+ "eos_token_id": 2,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "mpnet",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 1,
20
+ "relative_attention_num_buckets": 32,
21
+ "tie_word_embeddings": true,
22
+ "transformers_version": "5.13.1",
23
+ "use_cache": false,
24
+ "vocab_size": 30527
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.11.0+cu128",
4
+ "sentence_transformers": "5.6.0",
5
+ "transformers": "5.13.1"
6
+ },
7
+ "default_prompt_name": null,
8
+ "model_type": "SentenceTransformer",
9
+ "prompts": {
10
+ "document": "",
11
+ "query": ""
12
+ },
13
+ "similarity_fn_name": "cosine"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8020bf77910e22222f251eb8a71a27590d80e455120d5a2ff1aa130d1c6d11b
3
+ size 437967672
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.sentence_transformer.modules.normalize.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "feature-extraction",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "last_hidden_state"
7
+ }
8
+ },
9
+ "module_output_name": "token_embeddings"
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<s>",
4
+ "cls_token": "<s>",
5
+ "do_lower_case": true,
6
+ "eos_token": "</s>",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "mask_token": "<mask>",
10
+ "max_length": 128,
11
+ "model_max_length": 384,
12
+ "pad_to_multiple_of": null,
13
+ "pad_token": "<pad>",
14
+ "pad_token_type_id": 0,
15
+ "padding_side": "right",
16
+ "sep_token": "</s>",
17
+ "stride": 0,
18
+ "strip_accents": null,
19
+ "tokenize_chinese_chars": true,
20
+ "tokenizer_class": "MPNetTokenizer",
21
+ "truncation_side": "right",
22
+ "truncation_strategy": "longest_first",
23
+ "unk_token": "[UNK]"
24
+ }