simonepapa commited on
Commit
d027758
·
verified ·
1 Parent(s): 20fedb6

Add SetFit model

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,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: "Danze, canti, bandiere gialloazzurre e messaggi di pace davanti al piazzale\
9
+ \ della chiesa di San Ferdinando di Bari. Si è riunita in via Sparano, come annunciato\
10
+ \ ieri, la comunità ucraina barese, per protestare contro la guerra attualmente\
11
+ \ in atto e contro gli invasori russi. Adulti e bambini hanno sfilato nel centro\
12
+ \ murattiano nel 'Giorno dell'unità', in cui si celebra la firma dell'Atto di\
13
+ \ Unificazione, un accordo siglato il 22 gennaio 1919 dalla Repubblica Popolare\
14
+ \ Ucraina e dalla Repubblica Nazionale dell'Ucraina Occidentale nella piazza di\
15
+ \ Santa Sofia a Kiev. \n\"Ringraziamo non solo i baresi ma tutta l'Italia per\
16
+ \ la generosità. Grazie a loro possiamo ogni giorno cibo, vestiti e altri aiuti\
17
+ \ in Ucraina. Ogni giorno di guerra che passa, è un giorno di dolore anche per\
18
+ \ i nostri piccoli. Con tutto il cuore vogliamo ringraziarvi per queste unità:\
19
+ \ questo periodo ha dimostrato che tutto il mondo è unito a favore dell'umanità\"\
20
+ \ spiega una partecipante all'evento."
21
+ - text: 'L’ultimo appuntamento della prima parte della rassegna all’aperto “Ar/Giro
22
+ Di Accordi”, ideata e promossa dall’omonimo luogo di incontro e club raffinato
23
+ Argiro52 a Bari (info: 331.401.39.02), è previsto per giovedì 25 luglio alle 21.30
24
+ con il concerto del quintetto Interaction. Alla formazione composta da Guido di
25
+ Leone (chitarra), Giampaolo Laurentaci (contrabbasso) e Giovanni Scasciamacchia
26
+ (batteria), si aggiungeranno due guest: il sassofonista norvegese Martin Jacobsen
27
+ e il flicornista Fabrizio Gaudino.
28
+
29
+ “West Coast jazz” è il titolo del live in cui il quintetto eseguirà musiche di
30
+ Art Farmer, Jim Hall, Chet Baker, Jerry Mulligan, Paul Desmond e Stan Getz. Il
31
+ progetto nasce sulle orme del trombettista Art Farmer ed il chitarrista Jim Hall,
32
+ una delle più riuscite collaborazioni fra artisti “cool”. Il sound, l’idea del
33
+ jazz e parte del repertorio, vengono dai nostri musicisti riecheggiati con discrezione
34
+ e personalità, nel rispetto del passato e del linguaggio del jazz.
35
+
36
+ In ogni momento della tua vita, l''energia può fare la differenza. Con Acea Energia,
37
+ Luce e Gas, mobilità elettrica e servizi smart
38
+
39
+ Scegli Acea
40
+
41
+ Contenuto Sponsor
42
+
43
+ Jerry Mulligan e Chet Baker si incontrano e nasce il pianoless quartet, un nuovo
44
+ modo di proporre gli standards, senza strumenti armonici, rifacendosi alla tecnica
45
+ del contrappunto classico, Paul Desmond, Stan Getz disegnano assoli inconfondibili
46
+ caratterizzati da tecnica, lirismo e timbri morbidi. Gli Interaction ci proiettano
47
+ in un jazz raffinato, swing, armonicamente intrigante, melodicamente gradevole
48
+ e sorprendente.'
49
+ - text: 'Un''auto è finita, nel primo pomeriggio, sui paletti parapedonali del t5eatro
50
+ petruzzelli, danneggiandoli: a guidare il mezzo, un uomo di 75 anni. Sul posto
51
+ sono intervenute le pattuglie della Polizia Locale e un''autogru. Accertamenti
52
+ in corso per stabilire la dinamica degli episodi. Il conducente sarà segnalato
53
+ per richiesta di revisione accertamenti psicofisici e sanzionato per i danni causati.'
54
+ - text: 'Domenica 12 ore 10.30 appuntamento con il nuovo itinerario “BARI ECLETTICA”.
55
+ Alla scoperta dei palazzi simboli della borghesia e del commercio barese del secolo
56
+ scorso.
57
+
58
+
59
+ Costo: 10 euro
60
+
61
+
62
+ Punto d’incontro: Piazza Eroi del Mare c/o statua Araldo di Crollalanza
63
+
64
+
65
+ Prenotazione obbligatoria a [email protected] o tramite whatsapp al 3403394708
66
+ indicando il numero di partecipanti, un cognome e un contatto telefonico.
67
+
68
+ 200 GB e minuti illimitati a 7,90€/mese. Attivazione e 1° mese gratis.
69
+
70
+ Vedi Offerta
71
+
72
+ Contenuto Sponsor
73
+
74
+ Ottieni indicazioni con i mezzi pubblici verso: Madonnella
75
+
76
+ Linee che fermano vicino a Piazza Eroi del Mare
77
+
78
+ Crea il tuo widget'
79
+ - text: '"Non esistono professioni sanitarie di serie A e serie B": è il motto della
80
+ protesta che nella mattinata ha portato i laureati in psicologia, biologia e farmacia
81
+ a manifestare a Bari. Riunitisi in piazza Cesare Battisti, i manifestanti hanno
82
+ esposto striscioni e cartelli, chiedendo una modifica del sistema di abilitazione
83
+ professionale. "Esattamente come è avvenuto per medici e infermieri con il decreto
84
+ Cura Italia - spiegano i laureati- Chiediamo che il tirocinio venga riconosciuto
85
+ per l''abilitazione all''esercizio della professione". Una manifestazione che
86
+ è stata replicata in altre 12 città italiane, a supporto di quella romana, che
87
+ ha l''obiettivo di portare le istanze dei manifestanti al ministro dell''Università
88
+ e della ricerca Gaetano Manfredi.
89
+
90
+ "Noi psicologi - aggiunge Eugenio Trotta - ci ritroviamo a sostenere un���unica
91
+ prova orale per l''esame, a distanza e omnicomprensiva di tutte le materie previste
92
+ dall’Esame di Stato canonico, che normalmente consta di più prove ed è spalmato
93
+ su più mesi". Con tutti i limiti che i colloqui via internet portano con sé: "Non
94
+ è possibile rischiare una bocciatura in caso di problemi alla connessione, come
95
+ indicato nel regolamento dell''Università La Sapienza di Roma" conclude.
96
+
97
+ GALLERY'
98
+ metrics:
99
+ - accuracy
100
+ pipeline_tag: text-classification
101
+ library_name: setfit
102
+ inference: false
103
+ base_model: nickprock/sentence-bert-base-italian-uncased
104
+ ---
105
+
106
+ # SetFit with nickprock/sentence-bert-base-italian-uncased
107
+
108
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [nickprock/sentence-bert-base-italian-uncased](https://huggingface.co/nickprock/sentence-bert-base-italian-uncased) as the Sentence Transformer embedding model. A OneVsRestClassifier instance is used for classification.
109
+
110
+ The model has been trained using an efficient few-shot learning technique that involves:
111
+
112
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
113
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
114
+
115
+ ## Model Details
116
+
117
+ ### Model Description
118
+ - **Model Type:** SetFit
119
+ - **Sentence Transformer body:** [nickprock/sentence-bert-base-italian-uncased](https://huggingface.co/nickprock/sentence-bert-base-italian-uncased)
120
+ - **Classification head:** a OneVsRestClassifier instance
121
+ - **Maximum Sequence Length:** 512 tokens
122
+ <!-- - **Number of Classes:** Unknown -->
123
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
124
+ <!-- - **Language:** Unknown -->
125
+ <!-- - **License:** Unknown -->
126
+
127
+ ### Model Sources
128
+
129
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
130
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
131
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
132
+
133
+ ## Uses
134
+
135
+ ### Direct Use for Inference
136
+
137
+ First install the SetFit library:
138
+
139
+ ```bash
140
+ pip install setfit
141
+ ```
142
+
143
+ Then you can load this model and run inference.
144
+
145
+ ```python
146
+ from setfit import SetFitModel
147
+
148
+ # Download from the 🤗 Hub
149
+ model = SetFitModel.from_pretrained("simonepapa/setfit-baritoday-multilabel")
150
+ # Run inference
151
+ preds = model("Un'auto è finita, nel primo pomeriggio, sui paletti parapedonali del t5eatro petruzzelli, danneggiandoli: a guidare il mezzo, un uomo di 75 anni. Sul posto sono intervenute le pattuglie della Polizia Locale e un'autogru. Accertamenti in corso per stabilire la dinamica degli episodi. Il conducente sarà segnalato per richiesta di revisione accertamenti psicofisici e sanzionato per i danni causati.")
152
+ ```
153
+
154
+ <!--
155
+ ### Downstream Use
156
+
157
+ *List how someone could finetune this model on their own dataset.*
158
+ -->
159
+
160
+ <!--
161
+ ### Out-of-Scope Use
162
+
163
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
164
+ -->
165
+
166
+ <!--
167
+ ## Bias, Risks and Limitations
168
+
169
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
170
+ -->
171
+
172
+ <!--
173
+ ### Recommendations
174
+
175
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
176
+ -->
177
+
178
+ ## Training Details
179
+
180
+ ### Training Set Metrics
181
+ | Training set | Min | Median | Max |
182
+ |:-------------|:----|:---------|:-----|
183
+ | Word count | 42 | 154.4615 | 1030 |
184
+
185
+ ### Training Hyperparameters
186
+ - batch_size: (16, 16)
187
+ - num_epochs: (1, 1)
188
+ - max_steps: -1
189
+ - sampling_strategy: oversampling
190
+ - num_iterations: 20
191
+ - body_learning_rate: (2e-05, 2e-05)
192
+ - head_learning_rate: 2e-05
193
+ - loss: CosineSimilarityLoss
194
+ - distance_metric: cosine_distance
195
+ - margin: 0.25
196
+ - end_to_end: False
197
+ - use_amp: False
198
+ - warmup_proportion: 0.1
199
+ - l2_weight: 0.01
200
+ - seed: 42
201
+ - eval_max_steps: -1
202
+ - load_best_model_at_end: False
203
+
204
+ ### Training Results
205
+ | Epoch | Step | Training Loss | Validation Loss |
206
+ |:------:|:----:|:-------------:|:---------------:|
207
+ | 0.0038 | 1 | 0.1775 | - |
208
+ | 0.1923 | 50 | 0.1375 | - |
209
+ | 0.3846 | 100 | 0.0755 | - |
210
+ | 0.5769 | 150 | 0.0521 | - |
211
+ | 0.7692 | 200 | 0.0456 | - |
212
+ | 0.9615 | 250 | 0.0446 | - |
213
+
214
+ ### Framework Versions
215
+ - Python: 3.10.5
216
+ - SetFit: 1.1.0
217
+ - Sentence Transformers: 3.3.1
218
+ - Transformers: 4.42.2
219
+ - PyTorch: 2.5.1+cu124
220
+ - Datasets: 3.1.0
221
+ - Tokenizers: 0.19.1
222
+
223
+ ## Citation
224
+
225
+ ### BibTeX
226
+ ```bibtex
227
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
228
+ doi = {10.48550/ARXIV.2209.11055},
229
+ url = {https://arxiv.org/abs/2209.11055},
230
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
231
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
232
+ title = {Efficient Few-Shot Learning Without Prompts},
233
+ publisher = {arXiv},
234
+ year = {2022},
235
+ copyright = {Creative Commons Attribution 4.0 International}
236
+ }
237
+ ```
238
+
239
+ <!--
240
+ ## Glossary
241
+
242
+ *Clearly define terms in order to be accessible across audiences.*
243
+ -->
244
+
245
+ <!--
246
+ ## Model Card Authors
247
+
248
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
249
+ -->
250
+
251
+ <!--
252
+ ## Model Card Contact
253
+
254
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
255
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "nickprock/sentence-bert-base-italian-uncased",
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.42.2",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 31102
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.42.2",
5
+ "pytorch": "2.5.1+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": null
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81f6d18da2d7fb92632fbb297e1d7498f3032aff4550a80e125a569632f2a0c1
3
+ size 439733088
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9840f27bef4e182dfadd711d1269b62f9b2652b35fb0b9752ba80bfcd7973c8b
3
+ size 85140
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,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "mask_token": "[MASK]",
49
+ "max_len": 512,
50
+ "max_length": 512,
51
+ "model_max_length": 512,
52
+ "never_split": null,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "[PAD]",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "[SEP]",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "[UNK]"
65
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff