Henniina commited on
Commit
16839c6
·
verified ·
1 Parent(s): 4a114bd

Push model 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,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Etunimi Sukunimi Ruotsin kansasta yli puolet reilusti kannattaa Natoon hakemista.
9
+ Ainoana esteenä näkisin, että Ruotsin asevoimat eivät ole läheskään niin hyvällä
10
+ tolalla kuin Suomen mitä tulee varusmiehiin, reserviläisiin tai edes kalustoonkaan.
11
+ Mutta yhteisen hakemuksen kohdalla se tuskin olisi ongelma muille Nato-maille
12
+ hyväksynnän suhteen. Toinen ongelma on, että hyväksynnän tulisi olla sataprosenttinen
13
+ ja ei ole poissujettua, että Venäjä esmes vaikuttaisi yksittäiseen maahan niin,
14
+ että juuri se ei hyväksyisikään hakemusta.
15
+ - text: Etunimi Pugh nyt ymmärrän sun puolustelut asut jenkeissä.....
16
+ - text: Etunimi Sukunimi ei varmasti moni uskalla
17
+ - text: Etunimi Sukunimi Voisitko laittaa tuohon lastentappoväitteeseen mukaan jonkinlaista
18
+ faktaa. Jää muuten melko irralliseksi heitoksi. Ja etkös aiemmin korostanut, että
19
+ maa ei ole sama kuin ihmiset? No mikä on maa tai valtio, se on jäsentensä muodostama.
20
+ Nyt sitten väität, että Ukraina on maana tappanut lapsia 8 vuotta.
21
+ - text: Etunimi Sukunimi Historiaa kirjoitetaan vielä maaliskuun 2020 tapahtumista.
22
+ metrics:
23
+ - metric
24
+ pipeline_tag: text-classification
25
+ library_name: setfit
26
+ inference: true
27
+ base_model: TurkuNLP/bert-base-finnish-cased-v1
28
+ model-index:
29
+ - name: SetFit with TurkuNLP/bert-base-finnish-cased-v1
30
+ results:
31
+ - task:
32
+ type: text-classification
33
+ name: Text Classification
34
+ dataset:
35
+ name: Unknown
36
+ type: unknown
37
+ split: test
38
+ metrics:
39
+ - type: metric
40
+ value: 0.9395602682052082
41
+ name: Metric
42
+ ---
43
+
44
+ # SetFit with TurkuNLP/bert-base-finnish-cased-v1
45
+
46
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [TurkuNLP/bert-base-finnish-cased-v1](https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
47
+
48
+ The model has been trained using an efficient few-shot learning technique that involves:
49
+
50
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
51
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
52
+
53
+ ## Model Details
54
+
55
+ ### Model Description
56
+ - **Model Type:** SetFit
57
+ - **Sentence Transformer body:** [TurkuNLP/bert-base-finnish-cased-v1](https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1)
58
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
59
+ - **Maximum Sequence Length:** 512 tokens
60
+ - **Number of Classes:** 2 classes
61
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
62
+ <!-- - **Language:** Unknown -->
63
+ <!-- - **License:** Unknown -->
64
+
65
+ ### Model Sources
66
+
67
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
68
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
69
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
70
+
71
+ ### Model Labels
72
+ | Label | Examples |
73
+ |:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
74
+ | 0 | <ul><li>'Etunimi Raines jep. Suomalainen rokottamaton paha, ukrainalainen rokottamaton hyvä. Tää näkyy olevan nyt se mentaliteetti tällä hetkellä...'</li><li>'Etunimi Bistrom tilastot.'</li><li>'Etunimi Sukunimi myös delta oli suurimmalle osalle myös rokottamattomille lähes oireeton, omikron kuulemma vielä lievempi👏'</li></ul> |
75
+ | 1 | <ul><li>'Etunimi Sukunimi katoin ihan samaa tauti lisääntyy samaa tahtii ku piikitkii'</li><li>'Etunimi Sukunimi näinhän se on, ja uskon ja toivon että nyt Suomessakin ymmärretään että mitä putin tarkoitti kun sanoi puolustavansa kaikkia venäläisiä, riippumatta heidän kansallisuudestaan. Täällä Suomessa pitää nyt ottaa myös tarkasteluun että mikä merkitys suomen venäläisvähemmistöllä ja venäläisten maaomistuksilla on Suomessa. Vaikka suomen venäläiset eivät ikimaailmassa olisi Putinin puolella, he ovat merkittävä vipuvarsi Putinille kun hän perustelee mahdollisia toimia Suomen valtiota vastaan.'</li><li>'Etunimi Sukunimi tuohon kiinnitin minäkin huomiota ensimmäiseksi.'</li></ul> |
76
+
77
+ ## Evaluation
78
+
79
+ ### Metrics
80
+ | Label | Metric |
81
+ |:--------|:-------|
82
+ | **all** | 0.9396 |
83
+
84
+ ## Uses
85
+
86
+ ### Direct Use for Inference
87
+
88
+ First install the SetFit library:
89
+
90
+ ```bash
91
+ pip install setfit
92
+ ```
93
+
94
+ Then you can load this model and run inference.
95
+
96
+ ```python
97
+ from setfit import SetFitModel
98
+
99
+ # Download from the 🤗 Hub
100
+ model = SetFitModel.from_pretrained("Finnish-actions/SetFit-FinBERT1-A3-acceptance")
101
+ # Run inference
102
+ preds = model("Etunimi Sukunimi ei varmasti moni uskalla")
103
+ ```
104
+
105
+ <!--
106
+ ### Downstream Use
107
+
108
+ *List how someone could finetune this model on their own dataset.*
109
+ -->
110
+
111
+ <!--
112
+ ### Out-of-Scope Use
113
+
114
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
115
+ -->
116
+
117
+ <!--
118
+ ## Bias, Risks and Limitations
119
+
120
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
121
+ -->
122
+
123
+ <!--
124
+ ### Recommendations
125
+
126
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
127
+ -->
128
+
129
+ ## Training Details
130
+
131
+ ### Training Set Metrics
132
+ | Training set | Min | Median | Max |
133
+ |:-------------|:----|:--------|:----|
134
+ | Word count | 1 | 19.6854 | 213 |
135
+
136
+ | Label | Training Sample Count |
137
+ |:------|:----------------------|
138
+ | 0 | 874 |
139
+ | 1 | 89 |
140
+
141
+ ### Training Hyperparameters
142
+ - batch_size: (16, 16)
143
+ - num_epochs: (4, 4)
144
+ - max_steps: -1
145
+ - sampling_strategy: oversampling
146
+ - num_iterations: 6
147
+ - body_learning_rate: (2e-05, 1e-05)
148
+ - head_learning_rate: 0.01
149
+ - loss: CosineSimilarityLoss
150
+ - distance_metric: cosine_distance
151
+ - margin: 0.25
152
+ - end_to_end: False
153
+ - use_amp: False
154
+ - warmup_proportion: 0.1
155
+ - l2_weight: 0.01
156
+ - seed: 42
157
+ - evaluation_strategy: epoch
158
+ - eval_max_steps: -1
159
+ - load_best_model_at_end: False
160
+
161
+ ### Training Results
162
+ | Epoch | Step | Training Loss | Validation Loss |
163
+ |:------:|:----:|:-------------:|:---------------:|
164
+ | 0.0014 | 1 | 0.2574 | - |
165
+ | 0.0692 | 50 | 0.274 | - |
166
+ | 0.1383 | 100 | 0.2502 | - |
167
+ | 0.2075 | 150 | 0.2157 | - |
168
+ | 0.2766 | 200 | 0.1361 | - |
169
+ | 0.3458 | 250 | 0.0552 | - |
170
+ | 0.4149 | 300 | 0.0205 | - |
171
+ | 0.4841 | 350 | 0.0174 | - |
172
+ | 0.5533 | 400 | 0.0022 | - |
173
+ | 0.6224 | 450 | 0.0085 | - |
174
+ | 0.6916 | 500 | 0.0054 | - |
175
+ | 0.7607 | 550 | 0.0042 | - |
176
+ | 0.8299 | 600 | 0.0005 | - |
177
+ | 0.8990 | 650 | 0.0016 | - |
178
+ | 0.9682 | 700 | 0.0013 | - |
179
+ | 1.0 | 723 | - | 0.1899 |
180
+ | 1.0373 | 750 | 0.0016 | - |
181
+ | 1.1065 | 800 | 0.0074 | - |
182
+ | 1.1757 | 850 | 0.0022 | - |
183
+ | 1.2448 | 900 | 0.001 | - |
184
+ | 1.3140 | 950 | 0.0001 | - |
185
+ | 1.3831 | 1000 | 0.0073 | - |
186
+ | 1.4523 | 1050 | 0.0037 | - |
187
+ | 1.5214 | 1100 | 0.0046 | - |
188
+ | 1.5906 | 1150 | 0.0025 | - |
189
+ | 1.6598 | 1200 | 0.0027 | - |
190
+ | 1.7289 | 1250 | 0.0035 | - |
191
+ | 1.7981 | 1300 | 0.0021 | - |
192
+ | 1.8672 | 1350 | 0.0053 | - |
193
+ | 1.9364 | 1400 | 0.0034 | - |
194
+ | 2.0 | 1446 | - | 0.2088 |
195
+ | 2.0055 | 1450 | 0.0082 | - |
196
+ | 2.0747 | 1500 | 0.0059 | - |
197
+ | 2.1438 | 1550 | 0.0024 | - |
198
+ | 2.2130 | 1600 | 0.0005 | - |
199
+ | 2.2822 | 1650 | 0.0049 | - |
200
+ | 2.3513 | 1700 | 0.0029 | - |
201
+ | 2.4205 | 1750 | 0.0045 | - |
202
+ | 2.4896 | 1800 | 0.0031 | - |
203
+ | 2.5588 | 1850 | 0.002 | - |
204
+ | 2.6279 | 1900 | 0.0023 | - |
205
+ | 2.6971 | 1950 | 0.0053 | - |
206
+ | 2.7663 | 2000 | 0.0015 | - |
207
+ | 2.8354 | 2050 | 0.0025 | - |
208
+ | 2.9046 | 2100 | 0.0009 | - |
209
+ | 2.9737 | 2150 | 0.0015 | - |
210
+ | 3.0 | 2169 | - | 0.1619 |
211
+ | 3.0429 | 2200 | 0.0059 | - |
212
+ | 3.1120 | 2250 | 0.0034 | - |
213
+ | 3.1812 | 2300 | 0.0027 | - |
214
+ | 3.2503 | 2350 | 0.0038 | - |
215
+ | 3.3195 | 2400 | 0.0014 | - |
216
+ | 3.3887 | 2450 | 0.0034 | - |
217
+ | 3.4578 | 2500 | 0.0049 | - |
218
+ | 3.5270 | 2550 | 0.0024 | - |
219
+ | 3.5961 | 2600 | 0.0025 | - |
220
+ | 3.6653 | 2650 | 0.0025 | - |
221
+ | 3.7344 | 2700 | 0.0044 | - |
222
+ | 3.8036 | 2750 | 0.0004 | - |
223
+ | 3.8728 | 2800 | 0.0002 | - |
224
+ | 3.9419 | 2850 | 0.0012 | - |
225
+ | 4.0 | 2892 | - | 0.1642 |
226
+
227
+ ### Framework Versions
228
+ - Python: 3.11.9
229
+ - SetFit: 1.1.3
230
+ - Sentence Transformers: 3.2.0
231
+ - Transformers: 4.44.0
232
+ - PyTorch: 2.4.0+cu124
233
+ - Datasets: 2.21.0
234
+ - Tokenizers: 0.19.1
235
+
236
+ ## Citation
237
+
238
+ ### BibTeX
239
+ ```bibtex
240
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
241
+ doi = {10.48550/ARXIV.2209.11055},
242
+ url = {https://arxiv.org/abs/2209.11055},
243
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
244
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
245
+ title = {Efficient Few-Shot Learning Without Prompts},
246
+ publisher = {arXiv},
247
+ year = {2022},
248
+ copyright = {Creative Commons Attribution 4.0 International}
249
+ }
250
+ ```
251
+
252
+ <!--
253
+ ## Glossary
254
+
255
+ *Clearly define terms in order to be accessible across audiences.*
256
+ -->
257
+
258
+ <!--
259
+ ## Model Card Authors
260
+
261
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
262
+ -->
263
+
264
+ <!--
265
+ ## Model Card Contact
266
+
267
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
268
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "TurkuNLP/bert-base-finnish-cased-v1",
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": 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.44.0",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 50105
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.2.0",
4
+ "transformers": "4.44.0",
5
+ "pytorch": "2.4.0+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "labels": null,
3
+ "normalize_embeddings": false
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56e5bb0f727080815f9734f9ada81986285c4b668ae82667ac45937ff0d8deb9
3
+ size 498110312
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88f83b03dc457bbd2129390ad1153117ea10bf5a7af9dc8d7b0e51630be3b65a
3
+ size 7007
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,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "101": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "102": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "103": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "104": {
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_lower_case": false,
47
+ "mask_token": "[MASK]",
48
+ "model_max_length": 512,
49
+ "pad_token": "[PAD]",
50
+ "sep_token": "[SEP]",
51
+ "strip_accents": null,
52
+ "tokenize_chinese_chars": true,
53
+ "tokenizer_class": "BertTokenizer",
54
+ "unk_token": "[UNK]"
55
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff