Ananthu357 commited on
Commit
a0eea48
1 Parent(s): 6e663e7

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:360
13
+ - loss:CosineSimilarityLoss
14
+ widget:
15
+ - source_sentence: Liquidated Damages
16
+ sentences:
17
+ -         What is the deadline to submit the proposed project schedule?
18
+ - the Schedule to the Indian Medical Council Act
19
+ - Railway may, if satisfied that the works can be completed by the Contractor within
20
+ reasonable short time thereafter, allow the Contractor for further extension of
21
+ time (Proforma at Annexure-VII) as the Engineer may decide
22
+ - source_sentence: What determines the completion of performance of the contract?
23
+ sentences:
24
+ - Third party liability relationship is present in this contract.
25
+ - The Contractor shall indemnify railway against any claim of subcontractor.
26
+ - no certificate other than a Maintenance Certificate shall be considered approval
27
+ of any work or related matter for which it's issued.
28
+ - source_sentence: Indemnification clause
29
+ sentences:
30
+ - "Available Bid Capacity = [A x N x 2] \x96 B"
31
+ - The clause may be referred to as Interpretation clause
32
+ - The Contractor shall indemnify and save harmless the Railway from and against
33
+ all actions
34
+ - source_sentence: What is the cap for unfinished works for which the contractor can
35
+ offload with minimal consequences
36
+ sentences:
37
+ - Location for dispute resolution
38
+ - "in case the contractor\x92s failure is limited to only some of the works costing\
39
+ \ not more than 2% of the original contract value,"
40
+ - These Regulations for Tenders and Contracts shall be read in conjunction with
41
+ the Standard General Conditions of Contract which are referred to herein and shall
42
+ be subject to modifications additions or suppression by Special Conditions of
43
+ Contract and/or Special Specifications, if any, annexed to the Tender Forms.
44
+ - source_sentence: the amounts to be paid therefor shall be calculated in accordance
45
+ with the accepted Schedule of Rates.
46
+ sentences:
47
+ - Any material found during excavation should be reported to the engineer.
48
+ - The Contractor awarded the work shall submit, as soon as possible but no later
49
+ than the designated timeframe
50
+ - What is the deadline to submit the proposed project schedule?
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-contracts2.0")
101
+ # Run inference
102
+ sentences = [
103
+ 'the amounts to be paid therefor shall be calculated in accordance with the accepted Schedule of Rates.',
104
+ 'What is the deadline to submit the proposed project schedule?',
105
+ 'The Contractor awarded the work shall submit, as soon as possible but no later than the designated timeframe',
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`: 40
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`: 40
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
+ - `batch_sampler`: no_duplicates
276
+ - `multi_dataset_batch_sampler`: proportional
277
+
278
+ </details>
279
+
280
+ ### Training Logs
281
+ | Epoch | Step | Training Loss | loss |
282
+ |:-------:|:----:|:-------------:|:------:|
283
+ | 3.9565 | 100 | 0.0625 | 0.0461 |
284
+ | 7.7826 | 200 | 0.0112 | 0.0436 |
285
+ | 11.6087 | 300 | 0.0052 | 0.0399 |
286
+ | 15.4348 | 400 | 0.0022 | 0.0395 |
287
+ | 19.2609 | 500 | 0.0012 | 0.0391 |
288
+ | 23.0870 | 600 | 0.0009 | 0.0403 |
289
+ | 27.0435 | 700 | 0.0008 | 0.0403 |
290
+ | 30.8696 | 800 | 0.0007 | 0.0401 |
291
+ | 34.6957 | 900 | 0.0007 | 0.0403 |
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:9c5b48a33cb9bb9b4075702875a3eb45fe55a35495cb4592784c2a11869898b6
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