Leaboussekeyt commited on
Commit
83f08f8
·
verified ·
1 Parent(s): 3ef3a8b

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,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Trouver un vol de Marseille à Berlin, merci.
9
+ - text: La Corée du Nord a-t-elle des alertes de voyage que je devrais être conscientes
10
+ - text: Combien de côtés dans un hexagone
11
+ - text: Quelles sont les alertes pour le Mexique en ce moment ?
12
+ - text: Des alertes de voyage en France sont-elles en vigueur ?
13
+ metrics:
14
+ - accuracy
15
+ pipeline_tag: text-classification
16
+ library_name: setfit
17
+ inference: true
18
+ base_model: dangvantuan/sentence-camembert-base
19
+ ---
20
+
21
+ # SetFit with dangvantuan/sentence-camembert-base
22
+
23
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [dangvantuan/sentence-camembert-base](https://huggingface.co/dangvantuan/sentence-camembert-base) 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.
24
+
25
+ The model has been trained using an efficient few-shot learning technique that involves:
26
+
27
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
28
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
29
+
30
+ ## Model Details
31
+
32
+ ### Model Description
33
+ - **Model Type:** SetFit
34
+ - **Sentence Transformer body:** [dangvantuan/sentence-camembert-base](https://huggingface.co/dangvantuan/sentence-camembert-base)
35
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
36
+ - **Maximum Sequence Length:** 128 tokens
37
+ - **Number of Classes:** 9 classes
38
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
39
+ <!-- - **Language:** Unknown -->
40
+ <!-- - **License:** Unknown -->
41
+
42
+ ### Model Sources
43
+
44
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
45
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
46
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
47
+
48
+ ### Model Labels
49
+ | Label | Examples |
50
+ |:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
51
+ | 0 | <ul><li>"S'il vous plaît, aidez-moi à réserver un endroit où séjourner à Pittsburgh du lundi au vendredi"</li><li>'Réservez-moi une chambre du 11 au 15 novembre à Cali'</li><li>'Je souhaite réserver un hôtel à Rome.'</li></ul> |
52
+ | 1 | <ul><li>'Trouvez-moi des vols aller-retour de LAX vers SFOX'</li><li>'Réservez un vol de Chicago à DC lundi et revenant mercredi'</li><li>'Réserver un vol pour New York, aller-retour.'</li></ul> |
53
+ | 2 | <ul><li>'Y a-t-il des alertes de voyage pour la Syrie'</li><li>'La Corée du Nord a-t-elle des alertes de voyage que je devrais être conscientes'</li><li>'Y a-t-il des alertes de voyage pour le Japon ?'</li></ul> |
54
+ | 8 | <ul><li>'Combien de côtés dans un hexagone'</li><li>'Quand Nintendo a-t-il été créé'</li><li>"Quelle taille d'essuie-glace cette voiture prend-t-elle"</li></ul> |
55
+ | 3 | <ul><li>'Y a-t-il une limite de poids de bagage cabine'</li><li>'Quelles sont les règles concernant les bagages à main pour les vols Virgin Airlines'</li><li>'Quelles sont les règles pour les bagages à main?'</li></ul> |
56
+ | 4 | <ul><li>'Comment dire «hôtel» en finnois'</li><li>"Si j'étais japonais, comment dirais-je que je suis touriste"</li><li>"Pouvez-vous traduire 'bonjour' en espagnol?"</li></ul> |
57
+ | 5 | <ul><li>'Savez-vous qui je devrais contacter car mes valises ne sont pas arrivées'</li><li>'Je pense que mes bagages ont été perdus'</li><li>"J'ai perdu mes bagages, que dois-je faire?"</li></ul> |
58
+ | 6 | <ul><li>"quelle est la porte d'embarquement pour mon vol AF847"</li><li>'Quand mon vol décollera-t-il'</li><li>'Où puis-je vérifier le statut de mon vol?'</li></ul> |
59
+ | 7 | <ul><li>'Y a-t-il des activités touristiques amusantes en Australie'</li><li>'Donnez-moi une liste de choses à faire à Orlando'</li><li>'Pouvez-vous me suggérer des destinations de voyage?'</li></ul> |
60
+
61
+ ## Uses
62
+
63
+ ### Direct Use for Inference
64
+
65
+ First install the SetFit library:
66
+
67
+ ```bash
68
+ pip install setfit
69
+ ```
70
+
71
+ Then you can load this model and run inference.
72
+
73
+ ```python
74
+ from setfit import SetFitModel
75
+
76
+ # Download from the 🤗 Hub
77
+ model = SetFitModel.from_pretrained("leaboussekeyt/setfit_model")
78
+ # Run inference
79
+ preds = model("Combien de côtés dans un hexagone")
80
+ ```
81
+
82
+ <!--
83
+ ### Downstream Use
84
+
85
+ *List how someone could finetune this model on their own dataset.*
86
+ -->
87
+
88
+ <!--
89
+ ### Out-of-Scope Use
90
+
91
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
92
+ -->
93
+
94
+ <!--
95
+ ## Bias, Risks and Limitations
96
+
97
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
98
+ -->
99
+
100
+ <!--
101
+ ### Recommendations
102
+
103
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
104
+ -->
105
+
106
+ ## Training Details
107
+
108
+ ### Training Set Metrics
109
+ | Training set | Min | Median | Max |
110
+ |:-------------|:----|:-------|:----|
111
+ | Word count | 4 | 8.4302 | 16 |
112
+
113
+ | Label | Training Sample Count |
114
+ |:------|:----------------------|
115
+ | 0 | 10 |
116
+ | 1 | 10 |
117
+ | 2 | 10 |
118
+ | 3 | 10 |
119
+ | 4 | 10 |
120
+ | 5 | 10 |
121
+ | 6 | 10 |
122
+ | 7 | 10 |
123
+ | 8 | 6 |
124
+
125
+ ### Training Hyperparameters
126
+ - batch_size: (32, 32)
127
+ - num_epochs: (2, 2)
128
+ - max_steps: -1
129
+ - sampling_strategy: oversampling
130
+ - num_iterations: 20
131
+ - body_learning_rate: (2e-05, 1e-05)
132
+ - head_learning_rate: 0.01
133
+ - loss: CosineSimilarityLoss
134
+ - distance_metric: cosine_distance
135
+ - margin: 0.25
136
+ - end_to_end: False
137
+ - use_amp: False
138
+ - warmup_proportion: 0.1
139
+ - l2_weight: 0.01
140
+ - seed: 42
141
+ - eval_max_steps: -1
142
+ - load_best_model_at_end: False
143
+
144
+ ### Training Results
145
+ | Epoch | Step | Training Loss | Validation Loss |
146
+ |:------:|:----:|:-------------:|:---------------:|
147
+ | 0.0093 | 1 | 0.1927 | - |
148
+ | 0.4630 | 50 | 0.0828 | - |
149
+ | 0.9259 | 100 | 0.0139 | - |
150
+ | 1.3889 | 150 | 0.0055 | - |
151
+ | 1.8519 | 200 | 0.0036 | - |
152
+
153
+ ### Framework Versions
154
+ - Python: 3.11.11
155
+ - SetFit: 1.1.1
156
+ - Sentence Transformers: 3.4.1
157
+ - Transformers: 4.49.0
158
+ - PyTorch: 2.6.0+cu124
159
+ - Datasets: 3.4.1
160
+ - Tokenizers: 0.21.1
161
+
162
+ ## Citation
163
+
164
+ ### BibTeX
165
+ ```bibtex
166
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
167
+ doi = {10.48550/ARXIV.2209.11055},
168
+ url = {https://arxiv.org/abs/2209.11055},
169
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
170
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
171
+ title = {Efficient Few-Shot Learning Without Prompts},
172
+ publisher = {arXiv},
173
+ year = {2022},
174
+ copyright = {Creative Commons Attribution 4.0 International}
175
+ }
176
+ ```
177
+
178
+ <!--
179
+ ## Glossary
180
+
181
+ *Clearly define terms in order to be accessible across audiences.*
182
+ -->
183
+
184
+ <!--
185
+ ## Model Card Authors
186
+
187
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
188
+ -->
189
+
190
+ <!--
191
+ ## Model Card Contact
192
+
193
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
194
+ -->
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "dangvantuan/sentence-camembert-base",
3
+ "architectures": [
4
+ "CamembertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "eos_token_ids": 0,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-05,
17
+ "max_position_embeddings": 514,
18
+ "model_type": "camembert",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "output_past": true,
22
+ "pad_token_id": 0,
23
+ "position_embedding_type": "absolute",
24
+ "torch_dtype": "float32",
25
+ "transformers_version": "4.49.0",
26
+ "type_vocab_size": 1,
27
+ "use_cache": true,
28
+ "vocab_size": 32005
29
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.4.1",
4
+ "transformers": "4.49.0",
5
+ "pytorch": "2.6.0+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
+ "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:5b35912aa137f70a19e1c3680fbdfd80af3ff299e2b3ce63acc4b5e3e1b1d1d0
3
+ size 442510176
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24632a4f9949d412497b75a11da28f4a62a1130fddd5035bf1c633e09b687fdb
3
+ size 56287
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": 128,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<s>NOTUSED",
4
+ "</s>NOTUSED"
5
+ ],
6
+ "bos_token": {
7
+ "content": "<s>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "cls_token": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "eos_token": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false
26
+ },
27
+ "mask_token": {
28
+ "content": "<mask>",
29
+ "lstrip": true,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ },
34
+ "pad_token": {
35
+ "content": "<pad>",
36
+ "lstrip": false,
37
+ "normalized": false,
38
+ "rstrip": false,
39
+ "single_word": false
40
+ },
41
+ "sep_token": {
42
+ "content": "</s>",
43
+ "lstrip": false,
44
+ "normalized": false,
45
+ "rstrip": false,
46
+ "single_word": false
47
+ },
48
+ "unk_token": {
49
+ "content": "<unk>",
50
+ "lstrip": false,
51
+ "normalized": false,
52
+ "rstrip": false,
53
+ "single_word": false
54
+ }
55
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>NOTUSED",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>NOTUSED",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "5": {
36
+ "content": "<s>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "6": {
44
+ "content": "</s>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "32004": {
52
+ "content": "<mask>",
53
+ "lstrip": true,
54
+ "normalized": true,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ }
59
+ },
60
+ "additional_special_tokens": [
61
+ "<s>NOTUSED",
62
+ "</s>NOTUSED"
63
+ ],
64
+ "bos_token": "<s>",
65
+ "clean_up_tokenization_spaces": false,
66
+ "cls_token": "<s>",
67
+ "eos_token": "</s>",
68
+ "extra_special_tokens": {},
69
+ "mask_token": "<mask>",
70
+ "max_length": 128,
71
+ "model_max_length": 128,
72
+ "pad_to_multiple_of": null,
73
+ "pad_token": "<pad>",
74
+ "pad_token_type_id": 0,
75
+ "padding_side": "right",
76
+ "sep_token": "</s>",
77
+ "sp_model_kwargs": {},
78
+ "stride": 0,
79
+ "tokenizer_class": "CamembertTokenizer",
80
+ "truncation_side": "right",
81
+ "truncation_strategy": "longest_first",
82
+ "unk_token": "<unk>"
83
+ }