Ritvik Singh commited on
Commit
8eeafef
·
verified ·
1 Parent(s): 4eaa88e

Upload folder using huggingface_hub

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": true,
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
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - generated_from_trainer
7
+ - dataset_size:2000
8
+ - loss:MultipleNegativesRankingLoss
9
+ base_model: facebook/contriever
10
+ widget:
11
+ - source_sentence: This is passage number 195 in the document.
12
+ sentences:
13
+ - This is passage number 92 in the document.
14
+ - This is passage number 117 in the document.
15
+ - This is passage number 193 in the document.
16
+ - source_sentence: This is passage number 90 in the document.
17
+ sentences:
18
+ - This is passage number 50 in the document.
19
+ - This is passage number 119 in the document.
20
+ - This is passage number 88 in the document.
21
+ - source_sentence: This is passage number 27 in the document.
22
+ sentences:
23
+ - This is passage number 29 in the document.
24
+ - This is passage number 127 in the document.
25
+ - This is passage number 93 in the document.
26
+ - source_sentence: This is passage number 154 in the document.
27
+ sentences:
28
+ - This is passage number 4 in the document.
29
+ - This is passage number 18 in the document.
30
+ - This is passage number 155 in the document.
31
+ - source_sentence: This is passage number 199 in the document.
32
+ sentences:
33
+ - This is passage number 197 in the document.
34
+ - This is passage number 1 in the document.
35
+ - This is passage number 138 in the document.
36
+ pipeline_tag: sentence-similarity
37
+ library_name: sentence-transformers
38
+ ---
39
+
40
+ # SentenceTransformer based on facebook/contriever
41
+
42
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [facebook/contriever](https://huggingface.co/facebook/contriever). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
43
+
44
+ ## Model Details
45
+
46
+ ### Model Description
47
+ - **Model Type:** Sentence Transformer
48
+ - **Base model:** [facebook/contriever](https://huggingface.co/facebook/contriever) <!-- at revision 2bd46a25019aeea091fd42d1f0fd4801675cf699 -->
49
+ - **Maximum Sequence Length:** 512 tokens
50
+ - **Output Dimensionality:** 768 dimensions
51
+ - **Similarity Function:** Cosine Similarity
52
+ <!-- - **Training Dataset:** Unknown -->
53
+ <!-- - **Language:** Unknown -->
54
+ <!-- - **License:** Unknown -->
55
+
56
+ ### Model Sources
57
+
58
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
59
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
60
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
61
+
62
+ ### Full Model Architecture
63
+
64
+ ```
65
+ SentenceTransformer(
66
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
67
+ (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
68
+ )
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ### Direct Usage (Sentence Transformers)
74
+
75
+ First install the Sentence Transformers library:
76
+
77
+ ```bash
78
+ pip install -U sentence-transformers
79
+ ```
80
+
81
+ Then you can load this model and run inference.
82
+ ```python
83
+ from sentence_transformers import SentenceTransformer
84
+
85
+ # Download from the 🤗 Hub
86
+ model = SentenceTransformer("sentence_transformers_model_id")
87
+ # Run inference
88
+ sentences = [
89
+ 'This is passage number 199 in the document.',
90
+ 'This is passage number 197 in the document.',
91
+ 'This is passage number 138 in the document.',
92
+ ]
93
+ embeddings = model.encode(sentences)
94
+ print(embeddings.shape)
95
+ # [3, 768]
96
+
97
+ # Get the similarity scores for the embeddings
98
+ similarities = model.similarity(embeddings, embeddings)
99
+ print(similarities.shape)
100
+ # [3, 3]
101
+ ```
102
+
103
+ <!--
104
+ ### Direct Usage (Transformers)
105
+
106
+ <details><summary>Click to see the direct usage in Transformers</summary>
107
+
108
+ </details>
109
+ -->
110
+
111
+ <!--
112
+ ### Downstream Usage (Sentence Transformers)
113
+
114
+ You can finetune this model on your own dataset.
115
+
116
+ <details><summary>Click to expand</summary>
117
+
118
+ </details>
119
+ -->
120
+
121
+ <!--
122
+ ### Out-of-Scope Use
123
+
124
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
125
+ -->
126
+
127
+ <!--
128
+ ## Bias, Risks and Limitations
129
+
130
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
131
+ -->
132
+
133
+ <!--
134
+ ### Recommendations
135
+
136
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
137
+ -->
138
+
139
+ ## Training Details
140
+
141
+ ### Training Dataset
142
+
143
+ #### Unnamed Dataset
144
+
145
+ * Size: 2,000 training samples
146
+ * Columns: <code>sentence_0</code> and <code>sentence_1</code>
147
+ * Approximate statistics based on the first 1000 samples:
148
+ | | sentence_0 | sentence_1 |
149
+ |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
150
+ | type | string | string |
151
+ | details | <ul><li>min: 11 tokens</li><li>mean: 11.0 tokens</li><li>max: 11 tokens</li></ul> | <ul><li>min: 11 tokens</li><li>mean: 11.0 tokens</li><li>max: 11 tokens</li></ul> |
152
+ * Samples:
153
+ | sentence_0 | sentence_1 |
154
+ |:---------------------------------------------------------|:---------------------------------------------------------|
155
+ | <code>This is passage number 148 in the document.</code> | <code>This is passage number 150 in the document.</code> |
156
+ | <code>This is passage number 41 in the document.</code> | <code>This is passage number 39 in the document.</code> |
157
+ | <code>This is passage number 68 in the document.</code> | <code>This is passage number 66 in the document.</code> |
158
+ * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
159
+ ```json
160
+ {
161
+ "scale": 20.0,
162
+ "similarity_fct": "cos_sim"
163
+ }
164
+ ```
165
+
166
+ ### Training Hyperparameters
167
+ #### Non-Default Hyperparameters
168
+
169
+ - `per_device_train_batch_size`: 32
170
+ - `per_device_eval_batch_size`: 32
171
+ - `num_train_epochs`: 1
172
+ - `multi_dataset_batch_sampler`: round_robin
173
+
174
+ #### All Hyperparameters
175
+ <details><summary>Click to expand</summary>
176
+
177
+ - `overwrite_output_dir`: False
178
+ - `do_predict`: False
179
+ - `eval_strategy`: no
180
+ - `prediction_loss_only`: True
181
+ - `per_device_train_batch_size`: 32
182
+ - `per_device_eval_batch_size`: 32
183
+ - `per_gpu_train_batch_size`: None
184
+ - `per_gpu_eval_batch_size`: None
185
+ - `gradient_accumulation_steps`: 1
186
+ - `eval_accumulation_steps`: None
187
+ - `torch_empty_cache_steps`: None
188
+ - `learning_rate`: 5e-05
189
+ - `weight_decay`: 0.0
190
+ - `adam_beta1`: 0.9
191
+ - `adam_beta2`: 0.999
192
+ - `adam_epsilon`: 1e-08
193
+ - `max_grad_norm`: 1
194
+ - `num_train_epochs`: 1
195
+ - `max_steps`: -1
196
+ - `lr_scheduler_type`: linear
197
+ - `lr_scheduler_kwargs`: {}
198
+ - `warmup_ratio`: 0.0
199
+ - `warmup_steps`: 0
200
+ - `log_level`: passive
201
+ - `log_level_replica`: warning
202
+ - `log_on_each_node`: True
203
+ - `logging_nan_inf_filter`: True
204
+ - `save_safetensors`: True
205
+ - `save_on_each_node`: False
206
+ - `save_only_model`: False
207
+ - `restore_callback_states_from_checkpoint`: False
208
+ - `no_cuda`: False
209
+ - `use_cpu`: False
210
+ - `use_mps_device`: False
211
+ - `seed`: 42
212
+ - `data_seed`: None
213
+ - `jit_mode_eval`: False
214
+ - `use_ipex`: False
215
+ - `bf16`: False
216
+ - `fp16`: False
217
+ - `fp16_opt_level`: O1
218
+ - `half_precision_backend`: auto
219
+ - `bf16_full_eval`: False
220
+ - `fp16_full_eval`: False
221
+ - `tf32`: None
222
+ - `local_rank`: 0
223
+ - `ddp_backend`: None
224
+ - `tpu_num_cores`: None
225
+ - `tpu_metrics_debug`: False
226
+ - `debug`: []
227
+ - `dataloader_drop_last`: False
228
+ - `dataloader_num_workers`: 0
229
+ - `dataloader_prefetch_factor`: None
230
+ - `past_index`: -1
231
+ - `disable_tqdm`: False
232
+ - `remove_unused_columns`: True
233
+ - `label_names`: None
234
+ - `load_best_model_at_end`: False
235
+ - `ignore_data_skip`: False
236
+ - `fsdp`: []
237
+ - `fsdp_min_num_params`: 0
238
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
239
+ - `fsdp_transformer_layer_cls_to_wrap`: None
240
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
241
+ - `deepspeed`: None
242
+ - `label_smoothing_factor`: 0.0
243
+ - `optim`: adamw_torch
244
+ - `optim_args`: None
245
+ - `adafactor`: False
246
+ - `group_by_length`: False
247
+ - `length_column_name`: length
248
+ - `ddp_find_unused_parameters`: None
249
+ - `ddp_bucket_cap_mb`: None
250
+ - `ddp_broadcast_buffers`: False
251
+ - `dataloader_pin_memory`: True
252
+ - `dataloader_persistent_workers`: False
253
+ - `skip_memory_metrics`: True
254
+ - `use_legacy_prediction_loop`: False
255
+ - `push_to_hub`: False
256
+ - `resume_from_checkpoint`: None
257
+ - `hub_model_id`: None
258
+ - `hub_strategy`: every_save
259
+ - `hub_private_repo`: None
260
+ - `hub_always_push`: False
261
+ - `hub_revision`: None
262
+ - `gradient_checkpointing`: False
263
+ - `gradient_checkpointing_kwargs`: None
264
+ - `include_inputs_for_metrics`: False
265
+ - `include_for_metrics`: []
266
+ - `eval_do_concat_batches`: True
267
+ - `fp16_backend`: auto
268
+ - `push_to_hub_model_id`: None
269
+ - `push_to_hub_organization`: None
270
+ - `mp_parameters`:
271
+ - `auto_find_batch_size`: False
272
+ - `full_determinism`: False
273
+ - `torchdynamo`: None
274
+ - `ray_scope`: last
275
+ - `ddp_timeout`: 1800
276
+ - `torch_compile`: False
277
+ - `torch_compile_backend`: None
278
+ - `torch_compile_mode`: None
279
+ - `include_tokens_per_second`: False
280
+ - `include_num_input_tokens_seen`: False
281
+ - `neftune_noise_alpha`: None
282
+ - `optim_target_modules`: None
283
+ - `batch_eval_metrics`: False
284
+ - `eval_on_start`: False
285
+ - `use_liger_kernel`: False
286
+ - `liger_kernel_config`: None
287
+ - `eval_use_gather_object`: False
288
+ - `average_tokens_across_devices`: False
289
+ - `prompts`: None
290
+ - `batch_sampler`: batch_sampler
291
+ - `multi_dataset_batch_sampler`: round_robin
292
+
293
+ </details>
294
+
295
+ ### Framework Versions
296
+ - Python: 3.11.13
297
+ - Sentence Transformers: 4.1.0
298
+ - Transformers: 4.53.3
299
+ - PyTorch: 2.7.1+cu126
300
+ - Accelerate: 1.9.0
301
+ - Datasets: 4.0.0
302
+ - Tokenizers: 0.21.2
303
+
304
+ ## Citation
305
+
306
+ ### BibTeX
307
+
308
+ #### Sentence Transformers
309
+ ```bibtex
310
+ @inproceedings{reimers-2019-sentence-bert,
311
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
312
+ author = "Reimers, Nils and Gurevych, Iryna",
313
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
314
+ month = "11",
315
+ year = "2019",
316
+ publisher = "Association for Computational Linguistics",
317
+ url = "https://arxiv.org/abs/1908.10084",
318
+ }
319
+ ```
320
+
321
+ #### MultipleNegativesRankingLoss
322
+ ```bibtex
323
+ @misc{henderson2017efficient,
324
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
325
+ author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
326
+ year={2017},
327
+ eprint={1705.00652},
328
+ archivePrefix={arXiv},
329
+ primaryClass={cs.CL}
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,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 768,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 3072,
13
+ "layer_norm_eps": 1e-12,
14
+ "max_position_embeddings": 512,
15
+ "model_type": "bert",
16
+ "num_attention_heads": 12,
17
+ "num_hidden_layers": 12,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.53.3",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "4.1.0",
4
+ "transformers": "4.53.3",
5
+ "pytorch": "2.7.1+cu126"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5281c95ede7b8c417014cabd3ebcd17f6de9a0fba269bf2da4dd3116517758f
3
+ size 437951328
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
3
+ "do_lower_case": false
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,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "BertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff