Huzaifa68 commited on
Commit
27d3f59
1 Parent(s): 9595d27

Add new SentenceTransformer model.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 384,
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,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-small-en-v1.5
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:1332
13
+ - loss:MultipleNegativesRankingLoss
14
+ widget:
15
+ - source_sentence: alfalah ghp islamic income fund
16
+ sentences:
17
+ - alfalah ghp islamic prosperity planning fund
18
+ - financial value fund
19
+ - alfalah ghp islamic income fund
20
+ - source_sentence: alfalah islamic sovereign plan-1
21
+ sentences:
22
+ - alfalah ghp islamic prosperity planning fund
23
+ - alfalah islamic sovereign plan-1
24
+ - ghp islamic stock fund
25
+ - source_sentence: alfalah ghp alpha fund
26
+ sentences:
27
+ - alfalah islamic stable return plan – iii
28
+ - islamic dedicated equity fund
29
+ - alfalah ghp alpha fund
30
+ - source_sentence: alfalah islamic sovereign plan-2
31
+ sentences:
32
+ - alfalah islamic sovereign plan-3
33
+ - alfalah islamic sovereign plan-2
34
+ - islamic prosperity planning fund
35
+ - source_sentence: alfalah islamic sovereign plan-3
36
+ sentences:
37
+ - alfalah islamic stable return plan – iv
38
+ - alfalah islamic sovereign plan 3
39
+ - ghp islamic pension fund
40
+ ---
41
+
42
+ # SentenceTransformer based on BAAI/bge-small-en-v1.5
43
+
44
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5). It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
45
+
46
+ ## Model Details
47
+
48
+ ### Model Description
49
+ - **Model Type:** Sentence Transformer
50
+ - **Base model:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) <!-- at revision 5c38ec7c405ec4b44b94cc5a9bb96e735b38267a -->
51
+ - **Maximum Sequence Length:** 512 tokens
52
+ - **Output Dimensionality:** 384 tokens
53
+ - **Similarity Function:** Cosine Similarity
54
+ <!-- - **Training Dataset:** Unknown -->
55
+ <!-- - **Language:** Unknown -->
56
+ <!-- - **License:** Unknown -->
57
+
58
+ ### Model Sources
59
+
60
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
61
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
62
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
63
+
64
+ ### Full Model Architecture
65
+
66
+ ```
67
+ SentenceTransformer(
68
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
69
+ (1): Pooling({'word_embedding_dimension': 384, '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})
70
+ (2): Normalize()
71
+ )
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ ### Direct Usage (Sentence Transformers)
77
+
78
+ First install the Sentence Transformers library:
79
+
80
+ ```bash
81
+ pip install -U sentence-transformers
82
+ ```
83
+
84
+ Then you can load this model and run inference.
85
+ ```python
86
+ from sentence_transformers import SentenceTransformer
87
+
88
+ # Download from the 🤗 Hub
89
+ model = SentenceTransformer("Huzaifa68/investment_v1")
90
+ # Run inference
91
+ sentences = [
92
+ 'alfalah islamic sovereign plan-3',
93
+ 'alfalah islamic sovereign plan 3',
94
+ 'alfalah islamic stable return plan – iv',
95
+ ]
96
+ embeddings = model.encode(sentences)
97
+ print(embeddings.shape)
98
+ # [3, 384]
99
+
100
+ # Get the similarity scores for the embeddings
101
+ similarities = model.similarity(embeddings, embeddings)
102
+ print(similarities.shape)
103
+ # [3, 3]
104
+ ```
105
+
106
+ <!--
107
+ ### Direct Usage (Transformers)
108
+
109
+ <details><summary>Click to see the direct usage in Transformers</summary>
110
+
111
+ </details>
112
+ -->
113
+
114
+ <!--
115
+ ### Downstream Usage (Sentence Transformers)
116
+
117
+ You can finetune this model on your own dataset.
118
+
119
+ <details><summary>Click to expand</summary>
120
+
121
+ </details>
122
+ -->
123
+
124
+ <!--
125
+ ### Out-of-Scope Use
126
+
127
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
128
+ -->
129
+
130
+ <!--
131
+ ## Bias, Risks and Limitations
132
+
133
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
134
+ -->
135
+
136
+ <!--
137
+ ### Recommendations
138
+
139
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
140
+ -->
141
+
142
+ ## Training Details
143
+
144
+ ### Training Dataset
145
+
146
+ #### Unnamed Dataset
147
+
148
+
149
+ * Size: 1,332 training samples
150
+ * Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
151
+ * Approximate statistics based on the first 1000 samples:
152
+ | | anchor | positive | negative |
153
+ |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
154
+ | type | string | string | string |
155
+ | details | <ul><li>min: 7 tokens</li><li>mean: 9.36 tokens</li><li>max: 12 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 7.06 tokens</li><li>max: 12 tokens</li></ul> | <ul><li>min: 7 tokens</li><li>mean: 9.24 tokens</li><li>max: 12 tokens</li></ul> |
156
+ * Samples:
157
+ | anchor | positive | negative |
158
+ |:--------------------------------------------|:--------------------------------------------|:-------------------------------------------------------|
159
+ | <code>alfalah ghp islamic stock fund</code> | <code>ghp islamic stock fund</code> | <code>alfalah ghp islamic dedicated equity fund</code> |
160
+ | <code>alfalah ghp islamic stock fund</code> | <code>alfalah islamic stock fund</code> | <code>alfalah ghp islamic value fund</code> |
161
+ | <code>alfalah ghp islamic stock fund</code> | <code>alfalah ghp islamic stock fund</code> | <code>alfalah ghp islamic income fund</code> |
162
+ * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
163
+ ```json
164
+ {
165
+ "scale": 20.0,
166
+ "similarity_fct": "cos_sim"
167
+ }
168
+ ```
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`: 1
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
+ - `torch_empty_cache_steps`: None
195
+ - `learning_rate`: 5e-05
196
+ - `weight_decay`: 0.0
197
+ - `adam_beta1`: 0.9
198
+ - `adam_beta2`: 0.999
199
+ - `adam_epsilon`: 1e-08
200
+ - `max_grad_norm`: 1.0
201
+ - `num_train_epochs`: 1
202
+ - `max_steps`: -1
203
+ - `lr_scheduler_type`: linear
204
+ - `lr_scheduler_kwargs`: {}
205
+ - `warmup_ratio`: 0.1
206
+ - `warmup_steps`: 0
207
+ - `log_level`: passive
208
+ - `log_level_replica`: warning
209
+ - `log_on_each_node`: True
210
+ - `logging_nan_inf_filter`: True
211
+ - `save_safetensors`: True
212
+ - `save_on_each_node`: False
213
+ - `save_only_model`: False
214
+ - `restore_callback_states_from_checkpoint`: False
215
+ - `no_cuda`: False
216
+ - `use_cpu`: False
217
+ - `use_mps_device`: False
218
+ - `seed`: 42
219
+ - `data_seed`: None
220
+ - `jit_mode_eval`: False
221
+ - `use_ipex`: False
222
+ - `bf16`: False
223
+ - `fp16`: True
224
+ - `fp16_opt_level`: O1
225
+ - `half_precision_backend`: auto
226
+ - `bf16_full_eval`: False
227
+ - `fp16_full_eval`: False
228
+ - `tf32`: None
229
+ - `local_rank`: 0
230
+ - `ddp_backend`: None
231
+ - `tpu_num_cores`: None
232
+ - `tpu_metrics_debug`: False
233
+ - `debug`: []
234
+ - `dataloader_drop_last`: False
235
+ - `dataloader_num_workers`: 0
236
+ - `dataloader_prefetch_factor`: None
237
+ - `past_index`: -1
238
+ - `disable_tqdm`: False
239
+ - `remove_unused_columns`: True
240
+ - `label_names`: None
241
+ - `load_best_model_at_end`: False
242
+ - `ignore_data_skip`: False
243
+ - `fsdp`: []
244
+ - `fsdp_min_num_params`: 0
245
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
246
+ - `fsdp_transformer_layer_cls_to_wrap`: None
247
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
248
+ - `deepspeed`: None
249
+ - `label_smoothing_factor`: 0.0
250
+ - `optim`: adamw_torch
251
+ - `optim_args`: None
252
+ - `adafactor`: False
253
+ - `group_by_length`: False
254
+ - `length_column_name`: length
255
+ - `ddp_find_unused_parameters`: None
256
+ - `ddp_bucket_cap_mb`: None
257
+ - `ddp_broadcast_buffers`: False
258
+ - `dataloader_pin_memory`: True
259
+ - `dataloader_persistent_workers`: False
260
+ - `skip_memory_metrics`: True
261
+ - `use_legacy_prediction_loop`: False
262
+ - `push_to_hub`: False
263
+ - `resume_from_checkpoint`: None
264
+ - `hub_model_id`: None
265
+ - `hub_strategy`: every_save
266
+ - `hub_private_repo`: False
267
+ - `hub_always_push`: False
268
+ - `gradient_checkpointing`: False
269
+ - `gradient_checkpointing_kwargs`: None
270
+ - `include_inputs_for_metrics`: False
271
+ - `eval_do_concat_batches`: True
272
+ - `fp16_backend`: auto
273
+ - `push_to_hub_model_id`: None
274
+ - `push_to_hub_organization`: None
275
+ - `mp_parameters`:
276
+ - `auto_find_batch_size`: False
277
+ - `full_determinism`: False
278
+ - `torchdynamo`: None
279
+ - `ray_scope`: last
280
+ - `ddp_timeout`: 1800
281
+ - `torch_compile`: False
282
+ - `torch_compile_backend`: None
283
+ - `torch_compile_mode`: None
284
+ - `dispatch_batches`: None
285
+ - `split_batches`: None
286
+ - `include_tokens_per_second`: False
287
+ - `include_num_input_tokens_seen`: False
288
+ - `neftune_noise_alpha`: None
289
+ - `optim_target_modules`: None
290
+ - `batch_eval_metrics`: False
291
+ - `eval_on_start`: False
292
+ - `eval_use_gather_object`: False
293
+ - `batch_sampler`: no_duplicates
294
+ - `multi_dataset_batch_sampler`: proportional
295
+
296
+ </details>
297
+
298
+ ### Framework Versions
299
+ - Python: 3.10.12
300
+ - Sentence Transformers: 3.0.1
301
+ - Transformers: 4.44.2
302
+ - PyTorch: 2.4.1+cu121
303
+ - Accelerate: 0.34.2
304
+ - Datasets: 3.0.0
305
+ - Tokenizers: 0.19.1
306
+
307
+ ## Citation
308
+
309
+ ### BibTeX
310
+
311
+ #### Sentence Transformers
312
+ ```bibtex
313
+ @inproceedings{reimers-2019-sentence-bert,
314
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
315
+ author = "Reimers, Nils and Gurevych, Iryna",
316
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
317
+ month = "11",
318
+ year = "2019",
319
+ publisher = "Association for Computational Linguistics",
320
+ url = "https://arxiv.org/abs/1908.10084",
321
+ }
322
+ ```
323
+
324
+ #### MultipleNegativesRankingLoss
325
+ ```bibtex
326
+ @misc{henderson2017efficient,
327
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
328
+ 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},
329
+ year={2017},
330
+ eprint={1705.00652},
331
+ archivePrefix={arXiv},
332
+ primaryClass={cs.CL}
333
+ }
334
+ ```
335
+
336
+ <!--
337
+ ## Glossary
338
+
339
+ *Clearly define terms in order to be accessible across audiences.*
340
+ -->
341
+
342
+ <!--
343
+ ## Model Card Authors
344
+
345
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
346
+ -->
347
+
348
+ <!--
349
+ ## Model Card Contact
350
+
351
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
352
+ -->
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-small-en-v1.5",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 384,
11
+ "id2label": {
12
+ "0": "LABEL_0"
13
+ },
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 1536,
16
+ "label2id": {
17
+ "LABEL_0": 0
18
+ },
19
+ "layer_norm_eps": 1e-12,
20
+ "max_position_embeddings": 512,
21
+ "model_type": "bert",
22
+ "num_attention_heads": 12,
23
+ "num_hidden_layers": 12,
24
+ "pad_token_id": 0,
25
+ "position_embedding_type": "absolute",
26
+ "torch_dtype": "float32",
27
+ "transformers_version": "4.44.2",
28
+ "type_vocab_size": 2,
29
+ "use_cache": true,
30
+ "vocab_size": 30522
31
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.44.2",
5
+ "pytorch": "2.4.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:38bc3e1442439bd9c07bf2b1a7afb44b3df6030a237b2f36beedcb8b1cffd776
3
+ size 133462128
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