Ananthu357 commited on
Commit
c312e16
1 Parent(s): e617842

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
+ language: []
3
+ library_name: sentence-transformers
4
+ tags:
5
+ - sentence-transformers
6
+ - sentence-similarity
7
+ - feature-extraction
8
+ - generated_from_trainer
9
+ - dataset_size:207
10
+ - loss:CosineSimilarityLoss
11
+ base_model: BAAI/bge-large-en
12
+ datasets: []
13
+ widget:
14
+ - source_sentence: What are the additional documents that have to be read along with
15
+ the Standard General Conditions of Contract?
16
+ sentences:
17
+ -         Nothing stated herein shall preclude the Contractor in achieving earlier
18
+ completion of item or whole of the works than indicated in the programme.
19
+ - These Regulations for Tenders and Contracts shall be read in conjunction with
20
+ the Standard General Conditions of Contract which are referred to herein and shall
21
+ be subject to modifications additions or suppression by Special Conditions of
22
+ Contract and/or Special Specifications, if any, annexed to the Tender Forms.
23
+ - Does the contract contain a 'third party liability relations' clause?
24
+ - source_sentence: "Does the contract document contain a \x91third-party liability\
25
+ \ relationship\x92 provision?"
26
+ sentences:
27
+ - which it is issued or shall be taken as an admission of the due performance of
28
+ the contract or any part thereof.
29
+ - The Railway shall have the right to let other contracts in connection with the
30
+ works.
31
+ - What is the deadline to submit the proposed project schedule?
32
+ - source_sentence: What determines the completion of performance of the contract?
33
+ sentences:
34
+ - unless the Contractor has made a claim in writing in respect thereof before the
35
+ issue of the Maintenance Certificate under this clause.
36
+ -         or materials which may be obtained from any excavation made for the purpose
37
+ of the works or any building or produced upon the site at the time of delivery
38
+ of the possession.
39
+ - The Competent Authority to issue above Maintenance Certificate shall normally
40
+ be the authority who is competent to sign the contract.
41
+ - source_sentence: It shall be valid during the entire currency of the contract including
42
+ the period of extension, if any and the maintenance period after the work is completed.
43
+ sentences:
44
+ - Analysis of Unified Schedule of Rates of Indian Railways
45
+ - The issue cannot be resolved through arbitration.
46
+ - the Contractor by the Railway, the erection, maintenance and removal of all temporary
47
+ works and buildings, all watching, lighting, bailing, pumping and draining
48
+ - source_sentence: What determines the completion of performance of the contract?
49
+ sentences:
50
+ - What is the deadline to submit the proposed project schedule?
51
+ -         Maintenance certificate issuance
52
+ - The Contractor by the Railway, the erection, maintenance and removal of all temporary
53
+ works
54
+ pipeline_tag: sentence-similarity
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/BAAI-first-train")
105
+ # Run inference
106
+ sentences = [
107
+ 'What determines the completion of performance of the contract?',
108
+ 'The Contractor by the Railway, the erection, maintenance and removal of all temporary works',
109
+ '\xa0 \xa0 \xa0 \xa0 Maintenance certificate issuance',
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`: 40
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`: 40
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
+ | 6.3077 | 100 | 0.0535 | 0.0235 |
288
+ | 12.6154 | 200 | 0.0034 | 0.0269 |
289
+ | 18.9231 | 300 | 0.0011 | 0.0273 |
290
+ | 25.2308 | 400 | 0.0007 | 0.0281 |
291
+ | 31.3077 | 500 | 0.0006 | 0.0272 |
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:97f85100b341638167c26e4a973c2a56f5a948491ed7b3ddadf85053c932615e
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