ValentinaKim commited on
Commit
f327852
1 Parent(s): b7f04f4

Add new SentenceTransformer model.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
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,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-base-en-v1.5
3
+ datasets: []
4
+ language:
5
+ - en
6
+ library_name: sentence-transformers
7
+ license: apache-2.0
8
+ pipeline_tag: sentence-similarity
9
+ tags:
10
+ - sentence-transformers
11
+ - sentence-similarity
12
+ - feature-extraction
13
+ - generated_from_trainer
14
+ - dataset_size:6300
15
+ - loss:MatryoshkaLoss
16
+ - loss:MultipleNegativesRankingLoss
17
+ widget:
18
+ - source_sentence: Consumer Products segment decreased 10% to $3,572.5 million.
19
+ sentences:
20
+ - What was the impact of the Federal Reserve’s policy changes on Schwab money market
21
+ funds in 2022?
22
+ - What was the total revenue of Hasbro's Consumer Products segment in 2022?
23
+ - How much did the company's currently payable U.S. taxes amount to in 2023?
24
+ - source_sentence: PricewaterhouseCoopers LLP is mentioned as the Firm’s independent
25
+ registered public accounting firm (PCAOB ID 238) in the audit of the Consolidated
26
+ Financial Statements.
27
+ sentences:
28
+ - Where in the document can the Consolidated Financial Statements be found as mentioned
29
+ in a 2024 report?
30
+ - What type of firm is PricewaterhouseCoopers LLP as mentioned in the context of
31
+ auditing?
32
+ - Which note in the report provides details about legal proceedings?
33
+ - source_sentence: If, in the future, foreign exchange or capital control restrictions
34
+ were to be imposed and become applicable to us, such restrictions could potentially
35
+ reduce the amounts that we would be able to receive from our Macao, Hong Kong
36
+ and mainland China subsidiaries.
37
+ sentences:
38
+ - What are the potential consequences for the parent company if foreign exchange
39
+ or capital control restrictions were imposed in the future?
40
+ - What is described under Item 8 in the context of a financial document?
41
+ - What types of investments are primarily included in the Goldman Sachs' investments
42
+ in funds at NAV as of December 2023?
43
+ - source_sentence: Determining income tax provisions involves forecasting future financial
44
+ results, planning potential tax strategies, and evaluating the probability of
45
+ sustaining tax positions against audits.
46
+ sentences:
47
+ - What type of company is Johnson & Johnson described as?
48
+ - What determines the fair value of available-for-sale short-term investments?
49
+ - What factors influence the determination of income tax provisions and related
50
+ tax balances?
51
+ - source_sentence: During the fiscal year ended March 31, 2023, a $118 million tax
52
+ charge increased the valuation allowance on Swiss deferred tax assets, leading
53
+ to a higher effective tax rate.
54
+ sentences:
55
+ - What accounted for the significant tax rate increase in fiscal year 2023?
56
+ - What percentage of the box office revenue in the U.S./Canada was generated by
57
+ the three largest exhibitors in 2023?
58
+ - What percentage of eBay's 2023 net revenues were attributed to international markets?
59
+ ---
60
+
61
+ # BGE base Financial Matryoshka
62
+
63
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5). 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.
64
+
65
+ ## Model Details
66
+
67
+ ### Model Description
68
+ - **Model Type:** Sentence Transformer
69
+ - **Base model:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) <!-- at revision a5beb1e3e68b9ab74eb54cfd186867f64f240e1a -->
70
+ - **Maximum Sequence Length:** 512 tokens
71
+ - **Output Dimensionality:** 768 tokens
72
+ - **Similarity Function:** Cosine Similarity
73
+ <!-- - **Training Dataset:** Unknown -->
74
+ - **Language:** en
75
+ - **License:** apache-2.0
76
+
77
+ ### Model Sources
78
+
79
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
80
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
81
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
82
+
83
+ ### Full Model Architecture
84
+
85
+ ```
86
+ SentenceTransformer(
87
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
88
+ (1): Pooling({'word_embedding_dimension': 768, '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})
89
+ (2): Normalize()
90
+ )
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ ### Direct Usage (Sentence Transformers)
96
+
97
+ First install the Sentence Transformers library:
98
+
99
+ ```bash
100
+ pip install -U sentence-transformers
101
+ ```
102
+
103
+ Then you can load this model and run inference.
104
+ ```python
105
+ from sentence_transformers import SentenceTransformer
106
+
107
+ # Download from the 🤗 Hub
108
+ model = SentenceTransformer("ValentinaKim/bge-base-financial-matryoshka4")
109
+ # Run inference
110
+ sentences = [
111
+ 'During the fiscal year ended March 31, 2023, a $118 million tax charge increased the valuation allowance on Swiss deferred tax assets, leading to a higher effective tax rate.',
112
+ 'What accounted for the significant tax rate increase in fiscal year 2023?',
113
+ 'What percentage of the box office revenue in the U.S./Canada was generated by the three largest exhibitors in 2023?',
114
+ ]
115
+ embeddings = model.encode(sentences)
116
+ print(embeddings.shape)
117
+ # [3, 768]
118
+
119
+ # Get the similarity scores for the embeddings
120
+ similarities = model.similarity(embeddings, embeddings)
121
+ print(similarities.shape)
122
+ # [3, 3]
123
+ ```
124
+
125
+ <!--
126
+ ### Direct Usage (Transformers)
127
+
128
+ <details><summary>Click to see the direct usage in Transformers</summary>
129
+
130
+ </details>
131
+ -->
132
+
133
+ <!--
134
+ ### Downstream Usage (Sentence Transformers)
135
+
136
+ You can finetune this model on your own dataset.
137
+
138
+ <details><summary>Click to expand</summary>
139
+
140
+ </details>
141
+ -->
142
+
143
+ <!--
144
+ ### Out-of-Scope Use
145
+
146
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
147
+ -->
148
+
149
+ <!--
150
+ ## Bias, Risks and Limitations
151
+
152
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
153
+ -->
154
+
155
+ <!--
156
+ ### Recommendations
157
+
158
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
159
+ -->
160
+
161
+ ## Training Details
162
+
163
+ ### Training Dataset
164
+
165
+ #### Unnamed Dataset
166
+
167
+
168
+ * Size: 6,300 training samples
169
+ * Columns: <code>positive</code> and <code>anchor</code>
170
+ * Approximate statistics based on the first 1000 samples:
171
+ | | positive | anchor |
172
+ |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
173
+ | type | string | string |
174
+ | details | <ul><li>min: 2 tokens</li><li>mean: 46.25 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 2 tokens</li><li>mean: 20.35 tokens</li><li>max: 51 tokens</li></ul> |
175
+ * Samples:
176
+ | positive | anchor |
177
+ |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------|
178
+ | <code>For the year ended December 31, 2023, net cash used in financing activities included $1.8 billion for dividends to GM, which are eliminated within the consolidated statements of cash flows.</code> | <code>What amount of dividends to GM were included in the net cash used in financing activities for GM Financial for the year ended December 31, 2023?</code> |
179
+ | <code>Assets and liabilities of these foreign entities are translated at exchange rates in effect as of the balance sheet date.</code> | <code>At what values are assets and liabilities of foreign entities translated in financial statements?</code> |
180
+ | <code>The 21st Century Cures Act broadened patient access to certain enhanced benefits offered by Medicare Advantage plans, increasing the percentage of patients on these plans.</code> | <code>How did the 21st Century Cures Act affect patient access to Medicare Advantage plans?</code> |
181
+ * Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
182
+ ```json
183
+ {
184
+ "loss": "MultipleNegativesRankingLoss",
185
+ "matryoshka_dims": [
186
+ 768,
187
+ 512,
188
+ 256,
189
+ 128,
190
+ 64
191
+ ],
192
+ "matryoshka_weights": [
193
+ 1,
194
+ 1,
195
+ 1,
196
+ 1,
197
+ 1
198
+ ],
199
+ "n_dims_per_step": -1
200
+ }
201
+ ```
202
+
203
+ ### Framework Versions
204
+ - Python: 3.10.14
205
+ - Sentence Transformers: 3.0.1
206
+ - Transformers: 4.41.2
207
+ - PyTorch: 2.1.2+cu121
208
+ - Accelerate: 0.33.0
209
+ - Datasets: 2.19.1
210
+ - Tokenizers: 0.19.1
211
+
212
+ ## Citation
213
+
214
+ ### BibTeX
215
+
216
+ #### Sentence Transformers
217
+ ```bibtex
218
+ @inproceedings{reimers-2019-sentence-bert,
219
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
220
+ author = "Reimers, Nils and Gurevych, Iryna",
221
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
222
+ month = "11",
223
+ year = "2019",
224
+ publisher = "Association for Computational Linguistics",
225
+ url = "https://arxiv.org/abs/1908.10084",
226
+ }
227
+ ```
228
+
229
+ #### MatryoshkaLoss
230
+ ```bibtex
231
+ @misc{kusupati2024matryoshka,
232
+ title={Matryoshka Representation Learning},
233
+ author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
234
+ year={2024},
235
+ eprint={2205.13147},
236
+ archivePrefix={arXiv},
237
+ primaryClass={cs.LG}
238
+ }
239
+ ```
240
+
241
+ #### MultipleNegativesRankingLoss
242
+ ```bibtex
243
+ @misc{henderson2017efficient,
244
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
245
+ 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},
246
+ year={2017},
247
+ eprint={1705.00652},
248
+ archivePrefix={arXiv},
249
+ primaryClass={cs.CL}
250
+ }
251
+ ```
252
+
253
+ <!--
254
+ ## Glossary
255
+
256
+ *Clearly define terms in order to be accessible across audiences.*
257
+ -->
258
+
259
+ <!--
260
+ ## Model Card Authors
261
+
262
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
263
+ -->
264
+
265
+ <!--
266
+ ## Model Card Contact
267
+
268
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
269
+ -->
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-base-en-v1.5",
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": 768,
12
+ "id2label": {
13
+ "0": "LABEL_0"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
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": 12,
24
+ "num_hidden_layers": 12,
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.1.2+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:0d4db737f56aaea90796b5a8d219de0eee958295a575c611f6b417ad340151da
3
+ size 437951328
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