Henniina commited on
Commit
9260df9
·
verified ·
1 Parent(s): 700bab3

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 nyt unohdat, että punakapinaan oli sekaantunut myös venäläisiä
9
+ kommunisteja. Tukivat punakapinallisia asetoimituksin ja lähettämällä upseereita
10
+ johtamaan kapinaa. Yhteisen kielen puute vain onneksi häiritsi kapinallista työskentelyä.
11
+ Historiaa sinun kannattaa lukea vähän enemmän. Venäjä on hyökännyt Suomeen kremlin
12
+ johdolla useastikin. Alkaen jo tsarien ajoista. Pikku ja isoviha esim.
13
+ - text: 'Etunimi Sukunimi poistitko kommenttisi? Kirjoitin tällaisen vastauksen. Eipä
14
+ tuolla mitään lähteitä ollut mainittu. Ainoastaan tämä jutun perässä: "Pääkirjoitukset
15
+ ovat HS:n kannanottoja ajankohtaiseen aiheeseen. Kirjoitukset laatii HS:n pääkirjoitustoimitus,
16
+ ja ne heijastavat lehden periaatelinjaa."'
17
+ - text: Voi olla, mutta ennen sen hävityn sodan loppua kuolee paljon ukrainalaisia
18
+ ja myös venäläisiä eikä Putinia kavereineen saada siitä koskaan vastuuseen 😡
19
+ - text: Etunimi Sukunimi 🙋‍♀️
20
+ - text: Koska kolme rokotetta on täysi rokotesarja, niin todennäköisesti kolmesti
21
+ rokotettuja. Nyt kun niitä tarjotaan kuitenkin kaikille yli 18-vuotiaille.
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.9383579383579383
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
+ | 1 | <ul><li>'Etunimi Sukunimi herra senkun aloittaa keräyksen♥️'</li><li>'Etunimi Sukunimi Ei tarkoita vaihtoehdottomuutta. Vaan että jos hakee, niin kannattaa valmistautua kaikenlaiseen, "roskinpia" rajaloukkauksia myöten. Valmistautuminen ei tarkoita, etteikö silti voisi hakea, vaan sitä että voi taklata vaikutusyritykset mahdollisimman hyvin.'</li><li>'Etunimi KorpelaNiko Korpela selvitä nyt oikeasti mitä perustuslaissa sanotaan, se ei ole mikään mutulaki. Kysy oikeilta asiantuntijoilta👍'</li></ul> |
75
+ | 0 | <ul><li>'Etunimi Sukunimi venäjän syy hintojen nousu vai syytätkö sodastakin Suomen hallitusta ? 😖'</li><li>'Etunimi Sukunimi Olikhaan se virve'</li><li>'Etunimi Sukunimi onneks sentään ryyppäämään pääsee, eikä tule siihen ikäviä taukoja'</li></ul> |
76
+
77
+ ## Evaluation
78
+
79
+ ### Metrics
80
+ | Label | Metric |
81
+ |:--------|:-------|
82
+ | **all** | 0.9384 |
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-A1-request")
101
+ # Run inference
102
+ preds = model("Etunimi Sukunimi 🙋‍♀️")
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 | 20.3115 | 213 |
135
+
136
+ | Label | Training Sample Count |
137
+ |:------|:----------------------|
138
+ | 0 | 865 |
139
+ | 1 | 98 |
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.2738 | - |
165
+ | 0.0692 | 50 | 0.2725 | - |
166
+ | 0.1383 | 100 | 0.2507 | - |
167
+ | 0.2075 | 150 | 0.213 | - |
168
+ | 0.2766 | 200 | 0.121 | - |
169
+ | 0.3458 | 250 | 0.0333 | - |
170
+ | 0.4149 | 300 | 0.0085 | - |
171
+ | 0.4841 | 350 | 0.0034 | - |
172
+ | 0.5533 | 400 | 0.0014 | - |
173
+ | 0.6224 | 450 | 0.0003 | - |
174
+ | 0.6916 | 500 | 0.0002 | - |
175
+ | 0.7607 | 550 | 0.0003 | - |
176
+ | 0.8299 | 600 | 0.0007 | - |
177
+ | 0.8990 | 650 | 0.001 | - |
178
+ | 0.9682 | 700 | 0.0001 | - |
179
+ | 1.0 | 723 | - | 0.2364 |
180
+ | 1.0373 | 750 | 0.0001 | - |
181
+ | 1.1065 | 800 | 0.0001 | - |
182
+ | 1.1757 | 850 | 0.0001 | - |
183
+ | 1.2448 | 900 | 0.0007 | - |
184
+ | 1.3140 | 950 | 0.0026 | - |
185
+ | 1.3831 | 1000 | 0.0014 | - |
186
+ | 1.4523 | 1050 | 0.0036 | - |
187
+ | 1.5214 | 1100 | 0.0002 | - |
188
+ | 1.5906 | 1150 | 0.0001 | - |
189
+ | 1.6598 | 1200 | 0.0001 | - |
190
+ | 1.7289 | 1250 | 0.0001 | - |
191
+ | 1.7981 | 1300 | 0.0 | - |
192
+ | 1.8672 | 1350 | 0.0013 | - |
193
+ | 1.9364 | 1400 | 0.0001 | - |
194
+ | 2.0 | 1446 | - | 0.2504 |
195
+ | 2.0055 | 1450 | 0.0 | - |
196
+ | 2.0747 | 1500 | 0.0019 | - |
197
+ | 2.1438 | 1550 | 0.0001 | - |
198
+ | 2.2130 | 1600 | 0.0 | - |
199
+ | 2.2822 | 1650 | 0.0 | - |
200
+ | 2.3513 | 1700 | 0.0 | - |
201
+ | 2.4205 | 1750 | 0.0 | - |
202
+ | 2.4896 | 1800 | 0.0 | - |
203
+ | 2.5588 | 1850 | 0.0 | - |
204
+ | 2.6279 | 1900 | 0.0 | - |
205
+ | 2.6971 | 1950 | 0.0 | - |
206
+ | 2.7663 | 2000 | 0.0 | - |
207
+ | 2.8354 | 2050 | 0.0 | - |
208
+ | 2.9046 | 2100 | 0.0 | - |
209
+ | 2.9737 | 2150 | 0.0 | - |
210
+ | 3.0 | 2169 | - | 0.2230 |
211
+ | 3.0429 | 2200 | 0.0 | - |
212
+ | 3.1120 | 2250 | 0.0 | - |
213
+ | 3.1812 | 2300 | 0.0 | - |
214
+ | 3.2503 | 2350 | 0.0 | - |
215
+ | 3.3195 | 2400 | 0.0 | - |
216
+ | 3.3887 | 2450 | 0.0 | - |
217
+ | 3.4578 | 2500 | 0.0 | - |
218
+ | 3.5270 | 2550 | 0.0 | - |
219
+ | 3.5961 | 2600 | 0.0 | - |
220
+ | 3.6653 | 2650 | 0.0 | - |
221
+ | 3.7344 | 2700 | 0.0 | - |
222
+ | 3.8036 | 2750 | 0.0 | - |
223
+ | 3.8728 | 2800 | 0.0 | - |
224
+ | 3.9419 | 2850 | 0.0 | - |
225
+ | 4.0 | 2892 | - | 0.2222 |
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:519834250f842a261ff1c0b81fdce079d187c17a5a2e2bab5356088c5e0164f1
3
+ size 498110312
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e55a27c2d611793f334d99ef75dff8fce4354157eb4ea192176549e753d53e7
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