vineet10 commited on
Commit
b191ff3
1 Parent(s): f8e009a

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,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-base-en-v1.5
3
+ datasets: []
4
+ language:
5
+ - en
6
+ library_name: sentence-transformers
7
+ license: apache-2.0
8
+ pipeline_tag: sentence-similarity
9
+ tags:
10
+ - sentence-transformers
11
+ - sentence-similarity
12
+ - feature-extraction
13
+ - generated_from_trainer
14
+ - dataset_size:26
15
+ - loss:MultipleNegativesRankingLoss
16
+ widget:
17
+ - source_sentence: 'Answer: Users can contact Customer Care before confirmation to
18
+ request a refund for offline'
19
+ sentences:
20
+ - single order?
21
+ - a booking?
22
+ - MOU?
23
+ - source_sentence: The Employee agrees to be employed on the terms and conditions
24
+ set out in this Agreement.
25
+ sentences:
26
+ - What events constitute Force Majeure under this Agreement?
27
+ - What are the specific terms and conditions of employment?
28
+ - What is the scope of this Agreement?
29
+ - source_sentence: The term of this Agreement shall continue until terminated by either
30
+ party in accordance with
31
+ sentences:
32
+ - When does this Agreement terminate?
33
+ - What is the term of the Agreement?
34
+ - Can the Company make changes to the job title or duties of the Employee?
35
+ - source_sentence: The initial job title of the Employee will be Relationship Manager.
36
+ The initial job duties the
37
+ sentences:
38
+ - What remedies are available in case of a material breach of this Agreement?
39
+ - What representations and warranties does the Employee make to the Company?
40
+ - What are the initial job title and duties of the Employee?
41
+ - source_sentence: The Company has employed the Employee to render services as described
42
+ herein from the
43
+ sentences:
44
+ - What rules and policies must the Employee abide by?
45
+ - What are the general obligations of the Employee?
46
+ - When does the Company employ the Employee?
47
+ ---
48
+
49
+ # BGE base Financial Matryoshka
50
+
51
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5). 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.
52
+
53
+ ## Model Details
54
+
55
+ ### Model Description
56
+ - **Model Type:** Sentence Transformer
57
+ - **Base model:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) <!-- at revision a5beb1e3e68b9ab74eb54cfd186867f64f240e1a -->
58
+ - **Maximum Sequence Length:** 512 tokens
59
+ - **Output Dimensionality:** 768 tokens
60
+ - **Similarity Function:** Cosine Similarity
61
+ <!-- - **Training Dataset:** Unknown -->
62
+ - **Language:** en
63
+ - **License:** apache-2.0
64
+
65
+ ### Model Sources
66
+
67
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
68
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
69
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
70
+
71
+ ### Full Model Architecture
72
+
73
+ ```
74
+ SentenceTransformer(
75
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
76
+ (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})
77
+ (2): Normalize()
78
+ )
79
+ ```
80
+
81
+ ## Usage
82
+
83
+ ### Direct Usage (Sentence Transformers)
84
+
85
+ First install the Sentence Transformers library:
86
+
87
+ ```bash
88
+ pip install -U sentence-transformers
89
+ ```
90
+
91
+ Then you can load this model and run inference.
92
+ ```python
93
+ from sentence_transformers import SentenceTransformer
94
+
95
+ # Download from the 🤗 Hub
96
+ model = SentenceTransformer("vineet10/new_model_4")
97
+ # Run inference
98
+ sentences = [
99
+ 'The Company has employed the Employee to render services as described herein from the',
100
+ 'When does the Company employ the Employee?',
101
+ 'What are the general obligations of the Employee?',
102
+ ]
103
+ embeddings = model.encode(sentences)
104
+ print(embeddings.shape)
105
+ # [3, 768]
106
+
107
+ # Get the similarity scores for the embeddings
108
+ similarities = model.similarity(embeddings, embeddings)
109
+ print(similarities.shape)
110
+ # [3, 3]
111
+ ```
112
+
113
+ <!--
114
+ ### Direct Usage (Transformers)
115
+
116
+ <details><summary>Click to see the direct usage in Transformers</summary>
117
+
118
+ </details>
119
+ -->
120
+
121
+ <!--
122
+ ### Downstream Usage (Sentence Transformers)
123
+
124
+ You can finetune this model on your own dataset.
125
+
126
+ <details><summary>Click to expand</summary>
127
+
128
+ </details>
129
+ -->
130
+
131
+ <!--
132
+ ### Out-of-Scope Use
133
+
134
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
135
+ -->
136
+
137
+ <!--
138
+ ## Bias, Risks and Limitations
139
+
140
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
141
+ -->
142
+
143
+ <!--
144
+ ### Recommendations
145
+
146
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
147
+ -->
148
+
149
+ ## Training Details
150
+
151
+ ### Training Dataset
152
+
153
+ #### Unnamed Dataset
154
+
155
+
156
+ * Size: 26 training samples
157
+ * Columns: <code>context</code> and <code>question</code>
158
+ * Approximate statistics based on the first 1000 samples:
159
+ | | context | question |
160
+ |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
161
+ | type | string | string |
162
+ | details | <ul><li>min: 2 tokens</li><li>mean: 19.15 tokens</li><li>max: 28 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 11.35 tokens</li><li>max: 18 tokens</li></ul> |
163
+ * Samples:
164
+ | context | question |
165
+ |:----------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
166
+ | <code>The Employee agrees to diligently, honestly, and to the best of their abilities, perform all</code> | <code>What are the general obligations of the Employee?</code> |
167
+ | <code>The Company has employed the Employee to render services as described herein from the</code> | <code>When does the Company employ the Employee?</code> |
168
+ | <code>Answer: Users can report delays to Customer Care and expect an automatic refund within</code> | <code>order?</code> |
169
+ * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
170
+ ```json
171
+ {
172
+ "scale": 20.0,
173
+ "similarity_fct": "cos_sim"
174
+ }
175
+ ```
176
+
177
+ ### Training Hyperparameters
178
+ #### Non-Default Hyperparameters
179
+
180
+ - `eval_strategy`: steps
181
+ - `per_device_train_batch_size`: 16
182
+ - `per_device_eval_batch_size`: 16
183
+ - `num_train_epochs`: 1
184
+ - `warmup_ratio`: 0.1
185
+ - `fp16`: True
186
+ - `batch_sampler`: no_duplicates
187
+
188
+ #### All Hyperparameters
189
+ <details><summary>Click to expand</summary>
190
+
191
+ - `overwrite_output_dir`: False
192
+ - `do_predict`: False
193
+ - `eval_strategy`: steps
194
+ - `prediction_loss_only`: True
195
+ - `per_device_train_batch_size`: 16
196
+ - `per_device_eval_batch_size`: 16
197
+ - `per_gpu_train_batch_size`: None
198
+ - `per_gpu_eval_batch_size`: None
199
+ - `gradient_accumulation_steps`: 1
200
+ - `eval_accumulation_steps`: None
201
+ - `learning_rate`: 5e-05
202
+ - `weight_decay`: 0.0
203
+ - `adam_beta1`: 0.9
204
+ - `adam_beta2`: 0.999
205
+ - `adam_epsilon`: 1e-08
206
+ - `max_grad_norm`: 1.0
207
+ - `num_train_epochs`: 1
208
+ - `max_steps`: -1
209
+ - `lr_scheduler_type`: linear
210
+ - `lr_scheduler_kwargs`: {}
211
+ - `warmup_ratio`: 0.1
212
+ - `warmup_steps`: 0
213
+ - `log_level`: passive
214
+ - `log_level_replica`: warning
215
+ - `log_on_each_node`: True
216
+ - `logging_nan_inf_filter`: True
217
+ - `save_safetensors`: True
218
+ - `save_on_each_node`: False
219
+ - `save_only_model`: False
220
+ - `restore_callback_states_from_checkpoint`: False
221
+ - `no_cuda`: False
222
+ - `use_cpu`: False
223
+ - `use_mps_device`: False
224
+ - `seed`: 42
225
+ - `data_seed`: None
226
+ - `jit_mode_eval`: False
227
+ - `use_ipex`: False
228
+ - `bf16`: False
229
+ - `fp16`: True
230
+ - `fp16_opt_level`: O1
231
+ - `half_precision_backend`: auto
232
+ - `bf16_full_eval`: False
233
+ - `fp16_full_eval`: False
234
+ - `tf32`: None
235
+ - `local_rank`: 0
236
+ - `ddp_backend`: None
237
+ - `tpu_num_cores`: None
238
+ - `tpu_metrics_debug`: False
239
+ - `debug`: []
240
+ - `dataloader_drop_last`: False
241
+ - `dataloader_num_workers`: 0
242
+ - `dataloader_prefetch_factor`: None
243
+ - `past_index`: -1
244
+ - `disable_tqdm`: False
245
+ - `remove_unused_columns`: True
246
+ - `label_names`: None
247
+ - `load_best_model_at_end`: False
248
+ - `ignore_data_skip`: False
249
+ - `fsdp`: []
250
+ - `fsdp_min_num_params`: 0
251
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
252
+ - `fsdp_transformer_layer_cls_to_wrap`: None
253
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
254
+ - `deepspeed`: None
255
+ - `label_smoothing_factor`: 0.0
256
+ - `optim`: adamw_torch
257
+ - `optim_args`: None
258
+ - `adafactor`: False
259
+ - `group_by_length`: False
260
+ - `length_column_name`: length
261
+ - `ddp_find_unused_parameters`: None
262
+ - `ddp_bucket_cap_mb`: None
263
+ - `ddp_broadcast_buffers`: False
264
+ - `dataloader_pin_memory`: True
265
+ - `dataloader_persistent_workers`: False
266
+ - `skip_memory_metrics`: True
267
+ - `use_legacy_prediction_loop`: False
268
+ - `push_to_hub`: False
269
+ - `resume_from_checkpoint`: None
270
+ - `hub_model_id`: None
271
+ - `hub_strategy`: every_save
272
+ - `hub_private_repo`: False
273
+ - `hub_always_push`: False
274
+ - `gradient_checkpointing`: False
275
+ - `gradient_checkpointing_kwargs`: None
276
+ - `include_inputs_for_metrics`: False
277
+ - `eval_do_concat_batches`: True
278
+ - `fp16_backend`: auto
279
+ - `push_to_hub_model_id`: None
280
+ - `push_to_hub_organization`: None
281
+ - `mp_parameters`:
282
+ - `auto_find_batch_size`: False
283
+ - `full_determinism`: False
284
+ - `torchdynamo`: None
285
+ - `ray_scope`: last
286
+ - `ddp_timeout`: 1800
287
+ - `torch_compile`: False
288
+ - `torch_compile_backend`: None
289
+ - `torch_compile_mode`: None
290
+ - `dispatch_batches`: None
291
+ - `split_batches`: None
292
+ - `include_tokens_per_second`: False
293
+ - `include_num_input_tokens_seen`: False
294
+ - `neftune_noise_alpha`: None
295
+ - `optim_target_modules`: None
296
+ - `batch_eval_metrics`: False
297
+ - `eval_on_start`: False
298
+ - `batch_sampler`: no_duplicates
299
+ - `multi_dataset_batch_sampler`: proportional
300
+
301
+ </details>
302
+
303
+ ### Framework Versions
304
+ - Python: 3.10.12
305
+ - Sentence Transformers: 3.0.1
306
+ - Transformers: 4.42.4
307
+ - PyTorch: 2.3.1+cu121
308
+ - Accelerate: 0.32.1
309
+ - Datasets: 2.20.0
310
+ - Tokenizers: 0.19.1
311
+
312
+ ## Citation
313
+
314
+ ### BibTeX
315
+
316
+ #### Sentence Transformers
317
+ ```bibtex
318
+ @inproceedings{reimers-2019-sentence-bert,
319
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
320
+ author = "Reimers, Nils and Gurevych, Iryna",
321
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
322
+ month = "11",
323
+ year = "2019",
324
+ publisher = "Association for Computational Linguistics",
325
+ url = "https://arxiv.org/abs/1908.10084",
326
+ }
327
+ ```
328
+
329
+ #### MultipleNegativesRankingLoss
330
+ ```bibtex
331
+ @misc{henderson2017efficient,
332
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
333
+ author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
334
+ year={2017},
335
+ eprint={1705.00652},
336
+ archivePrefix={arXiv},
337
+ primaryClass={cs.CL}
338
+ }
339
+ ```
340
+
341
+ <!--
342
+ ## Glossary
343
+
344
+ *Clearly define terms in order to be accessible across audiences.*
345
+ -->
346
+
347
+ <!--
348
+ ## Model Card Authors
349
+
350
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
351
+ -->
352
+
353
+ <!--
354
+ ## Model Card Contact
355
+
356
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
357
+ -->
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-base-en-v1.5",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "id2label": {
13
+ "0": "LABEL_0"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "label2id": {
18
+ "LABEL_0": 0
19
+ },
20
+ "layer_norm_eps": 1e-12,
21
+ "max_position_embeddings": 512,
22
+ "model_type": "bert",
23
+ "num_attention_heads": 12,
24
+ "num_hidden_layers": 12,
25
+ "pad_token_id": 0,
26
+ "position_embedding_type": "absolute",
27
+ "torch_dtype": "float32",
28
+ "transformers_version": "4.42.4",
29
+ "type_vocab_size": 2,
30
+ "use_cache": true,
31
+ "vocab_size": 30522
32
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.42.4",
5
+ "pytorch": "2.3.1+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:0d4db737f56aaea90796b5a8d219de0eee958295a575c611f6b417ad340151da
3
+ size 437951328
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
3
+ "do_lower_case": true
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,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "never_split": null,
51
+ "pad_token": "[PAD]",
52
+ "sep_token": "[SEP]",
53
+ "strip_accents": null,
54
+ "tokenize_chinese_chars": true,
55
+ "tokenizer_class": "BertTokenizer",
56
+ "unk_token": "[UNK]"
57
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff