Ananthu357 commited on
Commit
c8fab4c
1 Parent(s): 0c12388

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,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:368
13
+ - loss:CosineSimilarityLoss
14
+ widget:
15
+ - source_sentence: These Standard General Conditions of Contract can be altered by
16
+ Special Conditions of Contract included in the Tender Forms.
17
+ sentences:
18
+ - The clause defines Order of Precedence very well.
19
+ - Does the contract contain a 'third party liability relations' clause?
20
+ -         Special Conditions can modify the Standard General Conditions.
21
+ - source_sentence: charges shall be debited to the Contractor's account in the hands
22
+ of the Railway
23
+ sentences:
24
+ - Doubts
25
+ -         The Contractor shall at his own expense provide with sheds, storehouses
26
+ and yards in such situations and in such numbers
27
+ - Third party liability relationship is present in this contract.
28
+ - source_sentence: Hold harmless clause
29
+ sentences:
30
+ - Any material found during excavation should be reported to the engineer.
31
+ - Submission of tenders
32
+ - The Contractor shall indemnify and save harmless the Railway from and against
33
+ all actions, suit, proceedings, losses, costs, damages, charges, claims and demands
34
+ of every nature and description brought or recovered against the Railways by reason
35
+ of any act or omission of the Contractor, his agents or employees, in the execution
36
+ of the works or in his guarding of the same. All sums payable by way of compensation
37
+ under any of these conditions shall be considered as reasonable compensation to
38
+ be applied to the actual loss or damage sustained, and whether or not any damage
39
+ shall have been sustained.
40
+ - source_sentence:         Commencement of works
41
+ sentences:
42
+ - as soon as possible but not later than 30 days after the date of receipt of the
43
+ acceptance letter
44
+ -         What is the deadline to submit the proposed project schedule?
45
+ -  If the Contractor shall be dissatisfied by reason of any decision of the Engineer's
46
+ representative, he shall be entitled to refer the matter to the Engineer who shall
47
+ there upon confirm or vary such decision.
48
+ - source_sentence: Responsibility for the storage facilities
49
+ sentences:
50
+ -         or materials which may be obtained from any excavation made for the purpose
51
+ of the works or any building or produced upon the site at the time of delivery
52
+ of the possession.
53
+ - Contradicton, Discrepance, Ambiguity
54
+ - Does the contract contain a 'third party liability relations' clause?
55
+ ---
56
+
57
+ # SentenceTransformer based on BAAI/bge-large-en
58
+
59
+ 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.
60
+
61
+ ## Model Details
62
+
63
+ ### Model Description
64
+ - **Model Type:** Sentence Transformer
65
+ - **Base model:** [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) <!-- at revision abe7d9d814b775ca171121fb03f394dc42974275 -->
66
+ - **Maximum Sequence Length:** 512 tokens
67
+ - **Output Dimensionality:** 1024 tokens
68
+ - **Similarity Function:** Cosine Similarity
69
+ <!-- - **Training Dataset:** Unknown -->
70
+ <!-- - **Language:** Unknown -->
71
+ <!-- - **License:** Unknown -->
72
+
73
+ ### Model Sources
74
+
75
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
76
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
77
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
78
+
79
+ ### Full Model Architecture
80
+
81
+ ```
82
+ SentenceTransformer(
83
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
84
+ (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})
85
+ (2): Normalize()
86
+ )
87
+ ```
88
+
89
+ ## Usage
90
+
91
+ ### Direct Usage (Sentence Transformers)
92
+
93
+ First install the Sentence Transformers library:
94
+
95
+ ```bash
96
+ pip install -U sentence-transformers
97
+ ```
98
+
99
+ Then you can load this model and run inference.
100
+ ```python
101
+ from sentence_transformers import SentenceTransformer
102
+
103
+ # Download from the 🤗 Hub
104
+ model = SentenceTransformer("Ananthu357/Ananthus-BAAI-for-contracts3.0")
105
+ # Run inference
106
+ sentences = [
107
+ 'Responsibility for the storage facilities',
108
+ "Does the contract contain a 'third party liability relations' clause?",
109
+ 'Contradicton, Discrepance, Ambiguity',
110
+ ]
111
+ embeddings = model.encode(sentences)
112
+ print(embeddings.shape)
113
+ # [3, 1024]
114
+
115
+ # Get the similarity scores for the embeddings
116
+ similarities = model.similarity(embeddings, embeddings)
117
+ print(similarities.shape)
118
+ # [3, 3]
119
+ ```
120
+
121
+ <!--
122
+ ### Direct Usage (Transformers)
123
+
124
+ <details><summary>Click to see the direct usage in Transformers</summary>
125
+
126
+ </details>
127
+ -->
128
+
129
+ <!--
130
+ ### Downstream Usage (Sentence Transformers)
131
+
132
+ You can finetune this model on your own dataset.
133
+
134
+ <details><summary>Click to expand</summary>
135
+
136
+ </details>
137
+ -->
138
+
139
+ <!--
140
+ ### Out-of-Scope Use
141
+
142
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
143
+ -->
144
+
145
+ <!--
146
+ ## Bias, Risks and Limitations
147
+
148
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
149
+ -->
150
+
151
+ <!--
152
+ ### Recommendations
153
+
154
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
155
+ -->
156
+
157
+ ## Training Details
158
+
159
+ ### Training Hyperparameters
160
+ #### Non-Default Hyperparameters
161
+
162
+ - `eval_strategy`: steps
163
+ - `per_device_train_batch_size`: 16
164
+ - `per_device_eval_batch_size`: 16
165
+ - `num_train_epochs`: 25
166
+ - `warmup_ratio`: 0.1
167
+ - `fp16`: True
168
+ - `batch_sampler`: no_duplicates
169
+
170
+ #### All Hyperparameters
171
+ <details><summary>Click to expand</summary>
172
+
173
+ - `overwrite_output_dir`: False
174
+ - `do_predict`: False
175
+ - `eval_strategy`: steps
176
+ - `prediction_loss_only`: True
177
+ - `per_device_train_batch_size`: 16
178
+ - `per_device_eval_batch_size`: 16
179
+ - `per_gpu_train_batch_size`: None
180
+ - `per_gpu_eval_batch_size`: None
181
+ - `gradient_accumulation_steps`: 1
182
+ - `eval_accumulation_steps`: None
183
+ - `learning_rate`: 5e-05
184
+ - `weight_decay`: 0.0
185
+ - `adam_beta1`: 0.9
186
+ - `adam_beta2`: 0.999
187
+ - `adam_epsilon`: 1e-08
188
+ - `max_grad_norm`: 1.0
189
+ - `num_train_epochs`: 25
190
+ - `max_steps`: -1
191
+ - `lr_scheduler_type`: linear
192
+ - `lr_scheduler_kwargs`: {}
193
+ - `warmup_ratio`: 0.1
194
+ - `warmup_steps`: 0
195
+ - `log_level`: passive
196
+ - `log_level_replica`: warning
197
+ - `log_on_each_node`: True
198
+ - `logging_nan_inf_filter`: True
199
+ - `save_safetensors`: True
200
+ - `save_on_each_node`: False
201
+ - `save_only_model`: False
202
+ - `restore_callback_states_from_checkpoint`: False
203
+ - `no_cuda`: False
204
+ - `use_cpu`: False
205
+ - `use_mps_device`: False
206
+ - `seed`: 42
207
+ - `data_seed`: None
208
+ - `jit_mode_eval`: False
209
+ - `use_ipex`: False
210
+ - `bf16`: False
211
+ - `fp16`: True
212
+ - `fp16_opt_level`: O1
213
+ - `half_precision_backend`: auto
214
+ - `bf16_full_eval`: False
215
+ - `fp16_full_eval`: False
216
+ - `tf32`: None
217
+ - `local_rank`: 0
218
+ - `ddp_backend`: None
219
+ - `tpu_num_cores`: None
220
+ - `tpu_metrics_debug`: False
221
+ - `debug`: []
222
+ - `dataloader_drop_last`: False
223
+ - `dataloader_num_workers`: 0
224
+ - `dataloader_prefetch_factor`: None
225
+ - `past_index`: -1
226
+ - `disable_tqdm`: False
227
+ - `remove_unused_columns`: True
228
+ - `label_names`: None
229
+ - `load_best_model_at_end`: False
230
+ - `ignore_data_skip`: False
231
+ - `fsdp`: []
232
+ - `fsdp_min_num_params`: 0
233
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
234
+ - `fsdp_transformer_layer_cls_to_wrap`: None
235
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
236
+ - `deepspeed`: None
237
+ - `label_smoothing_factor`: 0.0
238
+ - `optim`: adamw_torch
239
+ - `optim_args`: None
240
+ - `adafactor`: False
241
+ - `group_by_length`: False
242
+ - `length_column_name`: length
243
+ - `ddp_find_unused_parameters`: None
244
+ - `ddp_bucket_cap_mb`: None
245
+ - `ddp_broadcast_buffers`: False
246
+ - `dataloader_pin_memory`: True
247
+ - `dataloader_persistent_workers`: False
248
+ - `skip_memory_metrics`: True
249
+ - `use_legacy_prediction_loop`: False
250
+ - `push_to_hub`: False
251
+ - `resume_from_checkpoint`: None
252
+ - `hub_model_id`: None
253
+ - `hub_strategy`: every_save
254
+ - `hub_private_repo`: False
255
+ - `hub_always_push`: False
256
+ - `gradient_checkpointing`: False
257
+ - `gradient_checkpointing_kwargs`: None
258
+ - `include_inputs_for_metrics`: False
259
+ - `eval_do_concat_batches`: True
260
+ - `fp16_backend`: auto
261
+ - `push_to_hub_model_id`: None
262
+ - `push_to_hub_organization`: None
263
+ - `mp_parameters`:
264
+ - `auto_find_batch_size`: False
265
+ - `full_determinism`: False
266
+ - `torchdynamo`: None
267
+ - `ray_scope`: last
268
+ - `ddp_timeout`: 1800
269
+ - `torch_compile`: False
270
+ - `torch_compile_backend`: None
271
+ - `torch_compile_mode`: None
272
+ - `dispatch_batches`: None
273
+ - `split_batches`: None
274
+ - `include_tokens_per_second`: False
275
+ - `include_num_input_tokens_seen`: False
276
+ - `neftune_noise_alpha`: None
277
+ - `optim_target_modules`: None
278
+ - `batch_eval_metrics`: False
279
+ - `batch_sampler`: no_duplicates
280
+ - `multi_dataset_batch_sampler`: proportional
281
+
282
+ </details>
283
+
284
+ ### Training Logs
285
+ | Epoch | Step | Training Loss | loss |
286
+ |:-------:|:----:|:-------------:|:------:|
287
+ | 4.0870 | 100 | 0.0514 | 0.0630 |
288
+ | 8.0870 | 200 | 0.005 | 0.0527 |
289
+ | 12.0870 | 300 | 0.0019 | 0.0551 |
290
+ | 16.0870 | 400 | 0.0011 | 0.0534 |
291
+ | 20.0870 | 500 | 0.001 | 0.0543 |
292
+
293
+
294
+ ### Framework Versions
295
+ - Python: 3.10.12
296
+ - Sentence Transformers: 3.0.1
297
+ - Transformers: 4.41.2
298
+ - PyTorch: 2.3.0+cu121
299
+ - Accelerate: 0.31.0
300
+ - Datasets: 2.20.0
301
+ - Tokenizers: 0.19.1
302
+
303
+ ## Citation
304
+
305
+ ### BibTeX
306
+
307
+ #### Sentence Transformers
308
+ ```bibtex
309
+ @inproceedings{reimers-2019-sentence-bert,
310
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
311
+ author = "Reimers, Nils and Gurevych, Iryna",
312
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
313
+ month = "11",
314
+ year = "2019",
315
+ publisher = "Association for Computational Linguistics",
316
+ url = "https://arxiv.org/abs/1908.10084",
317
+ }
318
+ ```
319
+
320
+ <!--
321
+ ## Glossary
322
+
323
+ *Clearly define terms in order to be accessible across audiences.*
324
+ -->
325
+
326
+ <!--
327
+ ## Model Card Authors
328
+
329
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
330
+ -->
331
+
332
+ <!--
333
+ ## Model Card Contact
334
+
335
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
336
+ -->
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.41.2",
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.41.2",
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:16f388e918d5f2b6525f63e4bd64c97dd3fcf609fe85b985c0064286587ebc22
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