Ananthu357 commited on
Commit
5842142
1 Parent(s): 0eed87f

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,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:626
13
+ - loss:CosineSimilarityLoss
14
+ widget:
15
+ - source_sentence: What determines the completion of performance of the contract?
16
+ sentences:
17
+ - In a tender/contract, in case of any difference, contradiction, discrepancy, with
18
+ regard to conditions of tender/contract, specifications, drawings, bill of quantities
19
+ etc.
20
+ - The Contractor shall at all times during the progress and continuance of the works
21
+ and also for the period of maintenance specified in the Tender Form
22
+ - What determines the completion of performance of the contract?
23
+ - source_sentence: Early completion bonus
24
+ sentences:
25
+ - In case of ambiguity, order of precedence shall be referred.
26
+ - Contractor shall be entitled for a bonus of 1% for each 30 days early completion
27
+ of work.
28
+ - "The Railway shall have the right to let other contracts in connection with the\
29
+ \ works. The Contractor shall afford other Contractors reasonable opportunity\
30
+ \ for the storage of their materials and the execution of their works and shall\
31
+ \ properly connect and coordinate his work with theirs. If any part of the Contractor\x92\
32
+ s work depends upon proper execution or result upon the work of another Contractor(s),\
33
+ \ the Contractor shall inspect and promptly report to the Engineer any defects\
34
+ \ in such works that render it unsuitable for such proper execution and results.\
35
+ \ The Contractor's failure so-to inspect and report shall constitute an acceptance\
36
+ \ of the other Contractor's work as fit and proper for the reception of his work,\
37
+ \ except as to defects which may develop in the other Contractor's work after\
38
+ \ the execution of his work."
39
+ - source_sentence: Out of scope works
40
+ sentences:
41
+ - 'as to execution or quality of any work or material, or as to the measurements
42
+ of the works the decision of the Engineer thereon shall be final subject to the
43
+ appeal (within 7 days of such decision being intimated to the Contractor) to the
44
+ Chief Engineer '
45
+ - Should works over and above those included in the contract require to be executed
46
+ at the site, the Contractor shall have no right to be entrusted with the execution
47
+ of such works which may be carried out by another Contractor or Contractors or
48
+ by other means at the option of the Railway.
49
+ - What is the order of precedence in the case of ambiguity between drawings and
50
+ technical specifications?
51
+ - source_sentence: Deadline
52
+ sentences:
53
+ - shall be read in conjunction with the Standard General Conditions of Contract
54
+ which are referred to herein and shall be subject to modifications additions or
55
+ suppression by Special Conditions of Contract and/or Special Specifications, if
56
+ any, annexed to the Tender Forms.
57
+ - the sand, stone, clay ballast, earth, trees, rock
58
+ - not later than 30 days after the date of receipt
59
+ - source_sentence: Can the stones/rocks/bounders obtained during excavation be used
60
+ for construction if found technically satisfactory?
61
+ sentences:
62
+ - use the same for the purpose of the works either free of cost or pay the cost
63
+ - Any material found during excavation should be reported to the engineer.
64
+ - No certificate other than Maintenance Certificate, if applicable, referred to
65
+ in Clause 50 of the Conditions shall be deemed to constitute approval
66
+ ---
67
+
68
+ # SentenceTransformer based on BAAI/bge-large-en
69
+
70
+ 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.
71
+
72
+ ## Model Details
73
+
74
+ ### Model Description
75
+ - **Model Type:** Sentence Transformer
76
+ - **Base model:** [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) <!-- at revision abe7d9d814b775ca171121fb03f394dc42974275 -->
77
+ - **Maximum Sequence Length:** 512 tokens
78
+ - **Output Dimensionality:** 1024 tokens
79
+ - **Similarity Function:** Cosine Similarity
80
+ <!-- - **Training Dataset:** Unknown -->
81
+ <!-- - **Language:** Unknown -->
82
+ <!-- - **License:** Unknown -->
83
+
84
+ ### Model Sources
85
+
86
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
87
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
88
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
89
+
90
+ ### Full Model Architecture
91
+
92
+ ```
93
+ SentenceTransformer(
94
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
95
+ (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})
96
+ (2): Normalize()
97
+ )
98
+ ```
99
+
100
+ ## Usage
101
+
102
+ ### Direct Usage (Sentence Transformers)
103
+
104
+ First install the Sentence Transformers library:
105
+
106
+ ```bash
107
+ pip install -U sentence-transformers
108
+ ```
109
+
110
+ Then you can load this model and run inference.
111
+ ```python
112
+ from sentence_transformers import SentenceTransformer
113
+
114
+ # Download from the 🤗 Hub
115
+ model = SentenceTransformer("Ananthu357/Ananthus-BAAI-for-contracts10.0")
116
+ # Run inference
117
+ sentences = [
118
+ 'Can the stones/rocks/bounders obtained during excavation be used for construction if found technically satisfactory?',
119
+ 'use the same for the purpose of the works either free of cost or pay the cost',
120
+ 'No certificate other than Maintenance Certificate, if applicable, referred to in Clause 50 of the Conditions shall be deemed to constitute approval',
121
+ ]
122
+ embeddings = model.encode(sentences)
123
+ print(embeddings.shape)
124
+ # [3, 1024]
125
+
126
+ # Get the similarity scores for the embeddings
127
+ similarities = model.similarity(embeddings, embeddings)
128
+ print(similarities.shape)
129
+ # [3, 3]
130
+ ```
131
+
132
+ <!--
133
+ ### Direct Usage (Transformers)
134
+
135
+ <details><summary>Click to see the direct usage in Transformers</summary>
136
+
137
+ </details>
138
+ -->
139
+
140
+ <!--
141
+ ### Downstream Usage (Sentence Transformers)
142
+
143
+ You can finetune this model on your own dataset.
144
+
145
+ <details><summary>Click to expand</summary>
146
+
147
+ </details>
148
+ -->
149
+
150
+ <!--
151
+ ### Out-of-Scope Use
152
+
153
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
154
+ -->
155
+
156
+ <!--
157
+ ## Bias, Risks and Limitations
158
+
159
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
160
+ -->
161
+
162
+ <!--
163
+ ### Recommendations
164
+
165
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
166
+ -->
167
+
168
+ ## Training Details
169
+
170
+ ### Training Hyperparameters
171
+ #### Non-Default Hyperparameters
172
+
173
+ - `eval_strategy`: steps
174
+ - `per_device_train_batch_size`: 16
175
+ - `per_device_eval_batch_size`: 16
176
+ - `num_train_epochs`: 15
177
+ - `warmup_ratio`: 0.1
178
+ - `fp16`: True
179
+ - `batch_sampler`: no_duplicates
180
+
181
+ #### All Hyperparameters
182
+ <details><summary>Click to expand</summary>
183
+
184
+ - `overwrite_output_dir`: False
185
+ - `do_predict`: False
186
+ - `eval_strategy`: steps
187
+ - `prediction_loss_only`: True
188
+ - `per_device_train_batch_size`: 16
189
+ - `per_device_eval_batch_size`: 16
190
+ - `per_gpu_train_batch_size`: None
191
+ - `per_gpu_eval_batch_size`: None
192
+ - `gradient_accumulation_steps`: 1
193
+ - `eval_accumulation_steps`: None
194
+ - `learning_rate`: 5e-05
195
+ - `weight_decay`: 0.0
196
+ - `adam_beta1`: 0.9
197
+ - `adam_beta2`: 0.999
198
+ - `adam_epsilon`: 1e-08
199
+ - `max_grad_norm`: 1.0
200
+ - `num_train_epochs`: 15
201
+ - `max_steps`: -1
202
+ - `lr_scheduler_type`: linear
203
+ - `lr_scheduler_kwargs`: {}
204
+ - `warmup_ratio`: 0.1
205
+ - `warmup_steps`: 0
206
+ - `log_level`: passive
207
+ - `log_level_replica`: warning
208
+ - `log_on_each_node`: True
209
+ - `logging_nan_inf_filter`: True
210
+ - `save_safetensors`: True
211
+ - `save_on_each_node`: False
212
+ - `save_only_model`: False
213
+ - `restore_callback_states_from_checkpoint`: False
214
+ - `no_cuda`: False
215
+ - `use_cpu`: False
216
+ - `use_mps_device`: False
217
+ - `seed`: 42
218
+ - `data_seed`: None
219
+ - `jit_mode_eval`: False
220
+ - `use_ipex`: False
221
+ - `bf16`: False
222
+ - `fp16`: True
223
+ - `fp16_opt_level`: O1
224
+ - `half_precision_backend`: auto
225
+ - `bf16_full_eval`: False
226
+ - `fp16_full_eval`: False
227
+ - `tf32`: None
228
+ - `local_rank`: 0
229
+ - `ddp_backend`: None
230
+ - `tpu_num_cores`: None
231
+ - `tpu_metrics_debug`: False
232
+ - `debug`: []
233
+ - `dataloader_drop_last`: False
234
+ - `dataloader_num_workers`: 0
235
+ - `dataloader_prefetch_factor`: None
236
+ - `past_index`: -1
237
+ - `disable_tqdm`: False
238
+ - `remove_unused_columns`: True
239
+ - `label_names`: None
240
+ - `load_best_model_at_end`: False
241
+ - `ignore_data_skip`: False
242
+ - `fsdp`: []
243
+ - `fsdp_min_num_params`: 0
244
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
245
+ - `fsdp_transformer_layer_cls_to_wrap`: None
246
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
247
+ - `deepspeed`: None
248
+ - `label_smoothing_factor`: 0.0
249
+ - `optim`: adamw_torch
250
+ - `optim_args`: None
251
+ - `adafactor`: False
252
+ - `group_by_length`: False
253
+ - `length_column_name`: length
254
+ - `ddp_find_unused_parameters`: None
255
+ - `ddp_bucket_cap_mb`: None
256
+ - `ddp_broadcast_buffers`: False
257
+ - `dataloader_pin_memory`: True
258
+ - `dataloader_persistent_workers`: False
259
+ - `skip_memory_metrics`: True
260
+ - `use_legacy_prediction_loop`: False
261
+ - `push_to_hub`: False
262
+ - `resume_from_checkpoint`: None
263
+ - `hub_model_id`: None
264
+ - `hub_strategy`: every_save
265
+ - `hub_private_repo`: False
266
+ - `hub_always_push`: False
267
+ - `gradient_checkpointing`: False
268
+ - `gradient_checkpointing_kwargs`: None
269
+ - `include_inputs_for_metrics`: False
270
+ - `eval_do_concat_batches`: True
271
+ - `fp16_backend`: auto
272
+ - `push_to_hub_model_id`: None
273
+ - `push_to_hub_organization`: None
274
+ - `mp_parameters`:
275
+ - `auto_find_batch_size`: False
276
+ - `full_determinism`: False
277
+ - `torchdynamo`: None
278
+ - `ray_scope`: last
279
+ - `ddp_timeout`: 1800
280
+ - `torch_compile`: False
281
+ - `torch_compile_backend`: None
282
+ - `torch_compile_mode`: None
283
+ - `dispatch_batches`: None
284
+ - `split_batches`: None
285
+ - `include_tokens_per_second`: False
286
+ - `include_num_input_tokens_seen`: False
287
+ - `neftune_noise_alpha`: None
288
+ - `optim_target_modules`: None
289
+ - `batch_eval_metrics`: False
290
+ - `eval_on_start`: False
291
+ - `batch_sampler`: no_duplicates
292
+ - `multi_dataset_batch_sampler`: proportional
293
+
294
+ </details>
295
+
296
+ ### Training Logs
297
+ | Epoch | Step | Training Loss | loss |
298
+ |:-----:|:----:|:-------------:|:------:|
299
+ | 2.5 | 100 | 0.0568 | 0.1144 |
300
+ | 5.0 | 200 | 0.0099 | 0.0947 |
301
+ | 7.5 | 300 | 0.0039 | 0.1039 |
302
+ | 10.0 | 400 | 0.0021 | 0.1027 |
303
+ | 12.5 | 500 | 0.0014 | 0.1017 |
304
+ | 15.0 | 600 | 0.0012 | 0.1019 |
305
+
306
+
307
+ ### Framework Versions
308
+ - Python: 3.10.12
309
+ - Sentence Transformers: 3.0.1
310
+ - Transformers: 4.42.4
311
+ - PyTorch: 2.3.1+cu121
312
+ - Accelerate: 0.32.1
313
+ - Datasets: 2.21.0
314
+ - Tokenizers: 0.19.1
315
+
316
+ ## Citation
317
+
318
+ ### BibTeX
319
+
320
+ #### Sentence Transformers
321
+ ```bibtex
322
+ @inproceedings{reimers-2019-sentence-bert,
323
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
324
+ author = "Reimers, Nils and Gurevych, Iryna",
325
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
326
+ month = "11",
327
+ year = "2019",
328
+ publisher = "Association for Computational Linguistics",
329
+ url = "https://arxiv.org/abs/1908.10084",
330
+ }
331
+ ```
332
+
333
+ <!--
334
+ ## Glossary
335
+
336
+ *Clearly define terms in order to be accessible across audiences.*
337
+ -->
338
+
339
+ <!--
340
+ ## Model Card Authors
341
+
342
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
343
+ -->
344
+
345
+ <!--
346
+ ## Model Card Contact
347
+
348
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
349
+ -->
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:cdefaff05dfa10c317e31f30fd7fb2899ca61eea40170ef7a0919ae123c4f988
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