Ananthu357 commited on
Commit
32fb552
1 Parent(s): 356413f

Add new SentenceTransformer model.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
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,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-large-en
3
+ datasets: []
4
+ language: []
5
+ library_name: sentence-transformers
6
+ pipeline_tag: sentence-similarity
7
+ tags:
8
+ - sentence-transformers
9
+ - sentence-similarity
10
+ - feature-extraction
11
+ - generated_from_trainer
12
+ - dataset_size:623
13
+ - loss:CosineSimilarityLoss
14
+ widget:
15
+ - source_sentence: Contractor shall be liable to pay the actual expenses incurred
16
+ in measurements.
17
+ sentences:
18
+ - Does the contract contain a 'third party liability relations' clause?
19
+ - Does the contract contain a 'third party liability relations' clause?
20
+ - The additional documents to be referred are attached as annex to the tender forms.
21
+ - source_sentence: Amount for security deposit
22
+ sentences:
23
+ - save harmless the Railway from and against all actions
24
+ - The Security Deposit shall be 6% of the contract value.
25
+ - There shall be no modification expected.
26
+ - source_sentence: Storage of materials
27
+ sentences:
28
+ - If at any time, during the continuance of this contract, the performance in whole
29
+ or in part by either party of any obligation under this contract shall be prevented
30
+ or delayed by reason of any war, hostility, acts of public enemy, civil commotion,
31
+ sabotage, serious loss or damage by fire
32
+ - The Contractor shall at his own expense provide himself with sheds, storehouses
33
+ and yards in such situations and in such numbers
34
+ - The responsibility of successful completion of work by subcontractor shall lie
35
+ with Contractor.
36
+ - source_sentence: What determines the completion of performance of the contract?
37
+ sentences:
38
+ - The Contractor shall prepare and furnish to the Engineer once in every quarter
39
+ commencing from the month following the month of issue of Letter of Acceptance
40
+ - Coordination of the works clause is present in the contract
41
+ - The Maintenance Certificate shall be given by the Engineer upon the expiration
42
+ of the period of maintenance or as soon thereafter as any works ordered during
43
+ such period
44
+ - source_sentence: Amount for security deposit
45
+ sentences:
46
+ - The Security Deposit shall be 2.5% of the contract value.
47
+ - which it is issued or shall be taken as an admission of the due performance of
48
+ the contract or any part thereof.
49
+ - Tenders containing erasures and / or alterations of tender documents are liable
50
+ to be rejected.
51
+ ---
52
+
53
+ # SentenceTransformer based on BAAI/bge-large-en
54
+
55
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en). It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
56
+
57
+ ## Model Details
58
+
59
+ ### Model Description
60
+ - **Model Type:** Sentence Transformer
61
+ - **Base model:** [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) <!-- at revision abe7d9d814b775ca171121fb03f394dc42974275 -->
62
+ - **Maximum Sequence Length:** 512 tokens
63
+ - **Output Dimensionality:** 1024 tokens
64
+ - **Similarity Function:** Cosine Similarity
65
+ <!-- - **Training Dataset:** Unknown -->
66
+ <!-- - **Language:** Unknown -->
67
+ <!-- - **License:** Unknown -->
68
+
69
+ ### Model Sources
70
+
71
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
72
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
73
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
74
+
75
+ ### Full Model Architecture
76
+
77
+ ```
78
+ SentenceTransformer(
79
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
80
+ (1): Pooling({'word_embedding_dimension': 1024, '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})
81
+ (2): Normalize()
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("Ananthu357/Ananthus-BAAI-for-contracts9.0")
101
+ # Run inference
102
+ sentences = [
103
+ 'Amount for security deposit',
104
+ 'The Security Deposit shall be 2.5% of the contract value.',
105
+ 'Tenders containing erasures and / or alterations of tender documents are liable to be rejected.',
106
+ ]
107
+ embeddings = model.encode(sentences)
108
+ print(embeddings.shape)
109
+ # [3, 1024]
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 Hyperparameters
156
+ #### Non-Default Hyperparameters
157
+
158
+ - `eval_strategy`: steps
159
+ - `per_device_train_batch_size`: 16
160
+ - `per_device_eval_batch_size`: 16
161
+ - `num_train_epochs`: 15
162
+ - `warmup_ratio`: 0.1
163
+ - `fp16`: True
164
+ - `batch_sampler`: no_duplicates
165
+
166
+ #### All Hyperparameters
167
+ <details><summary>Click to expand</summary>
168
+
169
+ - `overwrite_output_dir`: False
170
+ - `do_predict`: False
171
+ - `eval_strategy`: steps
172
+ - `prediction_loss_only`: True
173
+ - `per_device_train_batch_size`: 16
174
+ - `per_device_eval_batch_size`: 16
175
+ - `per_gpu_train_batch_size`: None
176
+ - `per_gpu_eval_batch_size`: None
177
+ - `gradient_accumulation_steps`: 1
178
+ - `eval_accumulation_steps`: None
179
+ - `learning_rate`: 5e-05
180
+ - `weight_decay`: 0.0
181
+ - `adam_beta1`: 0.9
182
+ - `adam_beta2`: 0.999
183
+ - `adam_epsilon`: 1e-08
184
+ - `max_grad_norm`: 1.0
185
+ - `num_train_epochs`: 15
186
+ - `max_steps`: -1
187
+ - `lr_scheduler_type`: linear
188
+ - `lr_scheduler_kwargs`: {}
189
+ - `warmup_ratio`: 0.1
190
+ - `warmup_steps`: 0
191
+ - `log_level`: passive
192
+ - `log_level_replica`: warning
193
+ - `log_on_each_node`: True
194
+ - `logging_nan_inf_filter`: True
195
+ - `save_safetensors`: True
196
+ - `save_on_each_node`: False
197
+ - `save_only_model`: False
198
+ - `restore_callback_states_from_checkpoint`: False
199
+ - `no_cuda`: False
200
+ - `use_cpu`: False
201
+ - `use_mps_device`: False
202
+ - `seed`: 42
203
+ - `data_seed`: None
204
+ - `jit_mode_eval`: False
205
+ - `use_ipex`: False
206
+ - `bf16`: False
207
+ - `fp16`: True
208
+ - `fp16_opt_level`: O1
209
+ - `half_precision_backend`: auto
210
+ - `bf16_full_eval`: False
211
+ - `fp16_full_eval`: False
212
+ - `tf32`: None
213
+ - `local_rank`: 0
214
+ - `ddp_backend`: None
215
+ - `tpu_num_cores`: None
216
+ - `tpu_metrics_debug`: False
217
+ - `debug`: []
218
+ - `dataloader_drop_last`: False
219
+ - `dataloader_num_workers`: 0
220
+ - `dataloader_prefetch_factor`: None
221
+ - `past_index`: -1
222
+ - `disable_tqdm`: False
223
+ - `remove_unused_columns`: True
224
+ - `label_names`: None
225
+ - `load_best_model_at_end`: False
226
+ - `ignore_data_skip`: False
227
+ - `fsdp`: []
228
+ - `fsdp_min_num_params`: 0
229
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
230
+ - `fsdp_transformer_layer_cls_to_wrap`: None
231
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
232
+ - `deepspeed`: None
233
+ - `label_smoothing_factor`: 0.0
234
+ - `optim`: adamw_torch
235
+ - `optim_args`: None
236
+ - `adafactor`: False
237
+ - `group_by_length`: False
238
+ - `length_column_name`: length
239
+ - `ddp_find_unused_parameters`: None
240
+ - `ddp_bucket_cap_mb`: None
241
+ - `ddp_broadcast_buffers`: False
242
+ - `dataloader_pin_memory`: True
243
+ - `dataloader_persistent_workers`: False
244
+ - `skip_memory_metrics`: True
245
+ - `use_legacy_prediction_loop`: False
246
+ - `push_to_hub`: False
247
+ - `resume_from_checkpoint`: None
248
+ - `hub_model_id`: None
249
+ - `hub_strategy`: every_save
250
+ - `hub_private_repo`: False
251
+ - `hub_always_push`: False
252
+ - `gradient_checkpointing`: False
253
+ - `gradient_checkpointing_kwargs`: None
254
+ - `include_inputs_for_metrics`: False
255
+ - `eval_do_concat_batches`: True
256
+ - `fp16_backend`: auto
257
+ - `push_to_hub_model_id`: None
258
+ - `push_to_hub_organization`: None
259
+ - `mp_parameters`:
260
+ - `auto_find_batch_size`: False
261
+ - `full_determinism`: False
262
+ - `torchdynamo`: None
263
+ - `ray_scope`: last
264
+ - `ddp_timeout`: 1800
265
+ - `torch_compile`: False
266
+ - `torch_compile_backend`: None
267
+ - `torch_compile_mode`: None
268
+ - `dispatch_batches`: None
269
+ - `split_batches`: None
270
+ - `include_tokens_per_second`: False
271
+ - `include_num_input_tokens_seen`: False
272
+ - `neftune_noise_alpha`: None
273
+ - `optim_target_modules`: None
274
+ - `batch_eval_metrics`: False
275
+ - `eval_on_start`: False
276
+ - `batch_sampler`: no_duplicates
277
+ - `multi_dataset_batch_sampler`: proportional
278
+
279
+ </details>
280
+
281
+ ### Training Logs
282
+ | Epoch | Step | Training Loss | loss |
283
+ |:-------:|:----:|:-------------:|:------:|
284
+ | 2.5128 | 100 | 0.0572 | 0.0619 |
285
+ | 5.0256 | 200 | 0.0115 | 0.0560 |
286
+ | 7.5128 | 300 | 0.0044 | 0.0553 |
287
+ | 10.0256 | 400 | 0.0019 | 0.0559 |
288
+ | 12.5128 | 500 | 0.0014 | 0.0565 |
289
+
290
+
291
+ ### Framework Versions
292
+ - Python: 3.10.12
293
+ - Sentence Transformers: 3.0.1
294
+ - Transformers: 4.42.4
295
+ - PyTorch: 2.3.1+cu121
296
+ - Accelerate: 0.32.1
297
+ - Datasets: 2.21.0
298
+ - Tokenizers: 0.19.1
299
+
300
+ ## Citation
301
+
302
+ ### BibTeX
303
+
304
+ #### Sentence Transformers
305
+ ```bibtex
306
+ @inproceedings{reimers-2019-sentence-bert,
307
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
308
+ author = "Reimers, Nils and Gurevych, Iryna",
309
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
310
+ month = "11",
311
+ year = "2019",
312
+ publisher = "Association for Computational Linguistics",
313
+ url = "https://arxiv.org/abs/1908.10084",
314
+ }
315
+ ```
316
+
317
+ <!--
318
+ ## Glossary
319
+
320
+ *Clearly define terms in order to be accessible across audiences.*
321
+ -->
322
+
323
+ <!--
324
+ ## Model Card Authors
325
+
326
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
327
+ -->
328
+
329
+ <!--
330
+ ## Model Card Contact
331
+
332
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
333
+ -->
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-large-en",
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": 1024,
12
+ "id2label": {
13
+ "0": "LABEL_0"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 4096,
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": 16,
24
+ "num_hidden_layers": 24,
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:1bc8552ac21ff9974dfb657d844df993edbe43f95fa073283db7323757dc42f2
3
+ size 1340612432
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