oliviermills commited on
Commit
cc55f60
·
verified ·
1 Parent(s): 86d2a34

Training complete - F1: 0.8319

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 384,
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,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Katibat Tulkarm (PIJ) and Al Aqsa Martyrs Brigade militants exchanged fire
9
+ with Israeli border police forces that raided Tulkarm (Tulkarm, West Bank). Militants
10
+ also targeted Israeli forces with explosives. In conjunction with the shooting,
11
+ Palestinian rioters clashed with the Israeli forces. Israeli forces fired live
12
+ and rubber-coated bullets, tear gas canisters, and stun grenades to disperse the
13
+ rioters. Israeli forces shot 3 Katibat Tulkarm militants during the clashes, injuring
14
+ them. All 3 later succumbed to their injuries, another 4 were also injured.
15
+ - text: close to Barretos, Guanajuato, an armed individual shot and killed three other
16
+ men inside a parked vehicle on a dirt road. The armed individual then boarded
17
+ another vehicle driven by a second individual. 3 fatalities.
18
+ - text: Russian forces fired 122mm artillery at Yastrubyne, Sumy. Casualties unknown.
19
+ - text: Pro-Hadi forces manage to take a water project
20
+ - text: Injuries are reported during protests to demand potable water, food, and energy
21
+ in Lara state, Venezuela
22
+ metrics:
23
+ - accuracy
24
+ pipeline_tag: text-classification
25
+ library_name: setfit
26
+ inference: false
27
+ base_model: BAAI/bge-small-en-v1.5
28
+ ---
29
+
30
+ # SetFit with BAAI/bge-small-en-v1.5
31
+
32
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) as the Sentence Transformer embedding model. A OneVsRestClassifier instance is used for classification.
33
+
34
+ The model has been trained using an efficient few-shot learning technique that involves:
35
+
36
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
37
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
38
+
39
+ ## Model Details
40
+
41
+ ### Model Description
42
+ - **Model Type:** SetFit
43
+ - **Sentence Transformer body:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
44
+ - **Classification head:** a OneVsRestClassifier instance
45
+ - **Maximum Sequence Length:** 512 tokens
46
+ - **Number of Classes:** 3 classes
47
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
48
+ <!-- - **Language:** Unknown -->
49
+ <!-- - **License:** Unknown -->
50
+
51
+ ### Model Sources
52
+
53
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
54
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
55
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
56
+
57
+ ## Uses
58
+
59
+ ### Direct Use for Inference
60
+
61
+ First install the SetFit library:
62
+
63
+ ```bash
64
+ pip install setfit
65
+ ```
66
+
67
+ Then you can load this model and run inference.
68
+
69
+ ```python
70
+ from setfit import SetFitModel
71
+
72
+ # Download from the 🤗 Hub
73
+ model = SetFitModel.from_pretrained("baobabtech/water-conflict-classifier")
74
+ # Run inference
75
+ preds = model("Pro-Hadi forces manage to take a water project")
76
+ ```
77
+
78
+ <!--
79
+ ### Downstream Use
80
+
81
+ *List how someone could finetune this model on their own dataset.*
82
+ -->
83
+
84
+ <!--
85
+ ### Out-of-Scope Use
86
+
87
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
88
+ -->
89
+
90
+ <!--
91
+ ## Bias, Risks and Limitations
92
+
93
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
94
+ -->
95
+
96
+ <!--
97
+ ### Recommendations
98
+
99
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
100
+ -->
101
+
102
+ ## Training Details
103
+
104
+ ### Training Set Metrics
105
+ | Training set | Min | Median | Max |
106
+ |:-------------|:----|:--------|:----|
107
+ | Word count | 4 | 26.1843 | 167 |
108
+
109
+ ### Training Hyperparameters
110
+ - batch_size: (32, 32)
111
+ - num_epochs: (1, 1)
112
+ - max_steps: -1
113
+ - sampling_strategy: undersampling
114
+ - body_learning_rate: (2e-05, 1e-05)
115
+ - head_learning_rate: 0.01
116
+ - loss: CosineSimilarityLoss
117
+ - distance_metric: cosine_distance
118
+ - margin: 0.25
119
+ - end_to_end: False
120
+ - use_amp: False
121
+ - warmup_proportion: 0.1
122
+ - l2_weight: 0.01
123
+ - seed: 42
124
+ - eval_max_steps: -1
125
+ - load_best_model_at_end: True
126
+
127
+ ### Training Results
128
+ | Epoch | Step | Training Loss | Validation Loss |
129
+ |:------:|:----:|:-------------:|:---------------:|
130
+ | 0.0008 | 1 | 0.2363 | - |
131
+ | 0.0377 | 50 | 0.212 | - |
132
+ | 0.0754 | 100 | 0.1063 | - |
133
+ | 0.1131 | 150 | 0.0875 | - |
134
+ | 0.1508 | 200 | 0.0637 | - |
135
+ | 0.1885 | 250 | 0.0487 | - |
136
+ | 0.2262 | 300 | 0.0391 | - |
137
+ | 0.2640 | 350 | 0.0335 | - |
138
+ | 0.3017 | 400 | 0.0307 | - |
139
+ | 0.3394 | 450 | 0.027 | - |
140
+ | 0.3771 | 500 | 0.0274 | - |
141
+ | 0.4148 | 550 | 0.0273 | - |
142
+ | 0.4525 | 600 | 0.0298 | - |
143
+ | 0.4902 | 650 | 0.0267 | - |
144
+ | 0.5279 | 700 | 0.0242 | - |
145
+ | 0.5656 | 750 | 0.027 | - |
146
+ | 0.6033 | 800 | 0.0233 | - |
147
+ | 0.6410 | 850 | 0.027 | - |
148
+ | 0.6787 | 900 | 0.0225 | - |
149
+ | 0.7164 | 950 | 0.0237 | - |
150
+ | 0.7541 | 1000 | 0.0203 | - |
151
+ | 0.7919 | 1050 | 0.0193 | - |
152
+ | 0.8296 | 1100 | 0.0202 | - |
153
+ | 0.8673 | 1150 | 0.0202 | - |
154
+ | 0.9050 | 1200 | 0.0213 | - |
155
+ | 0.9427 | 1250 | 0.0216 | - |
156
+ | 0.9804 | 1300 | 0.019 | - |
157
+ | 1.0 | 1326 | - | 0.0649 |
158
+
159
+ ### Framework Versions
160
+ - Python: 3.12.12
161
+ - SetFit: 1.1.3
162
+ - Sentence Transformers: 5.1.2
163
+ - Transformers: 4.57.3
164
+ - PyTorch: 2.9.1+cu128
165
+ - Datasets: 4.4.1
166
+ - Tokenizers: 0.22.1
167
+
168
+ ## Citation
169
+
170
+ ### BibTeX
171
+ ```bibtex
172
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
173
+ doi = {10.48550/ARXIV.2209.11055},
174
+ url = {https://arxiv.org/abs/2209.11055},
175
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
176
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
177
+ title = {Efficient Few-Shot Learning Without Prompts},
178
+ publisher = {arXiv},
179
+ year = {2022},
180
+ copyright = {Creative Commons Attribution 4.0 International}
181
+ }
182
+ ```
183
+
184
+ <!--
185
+ ## Glossary
186
+
187
+ *Clearly define terms in order to be accessible across audiences.*
188
+ -->
189
+
190
+ <!--
191
+ ## Model Card Authors
192
+
193
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
194
+ -->
195
+
196
+ <!--
197
+ ## Model Card Contact
198
+
199
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
200
+ -->
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "dtype": "float32",
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 384,
11
+ "id2label": {
12
+ "0": "LABEL_0"
13
+ },
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 1536,
16
+ "label2id": {
17
+ "LABEL_0": 0
18
+ },
19
+ "layer_norm_eps": 1e-12,
20
+ "max_position_embeddings": 512,
21
+ "model_type": "bert",
22
+ "num_attention_heads": 12,
23
+ "num_hidden_layers": 12,
24
+ "pad_token_id": 0,
25
+ "position_embedding_type": "absolute",
26
+ "transformers_version": "4.57.3",
27
+ "type_vocab_size": 2,
28
+ "use_cache": true,
29
+ "vocab_size": 30522
30
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.1.2",
4
+ "transformers": "4.57.3",
5
+ "pytorch": "2.9.1+cu128"
6
+ },
7
+ "model_type": "SentenceTransformer",
8
+ "prompts": {
9
+ "query": "",
10
+ "document": ""
11
+ },
12
+ "default_prompt_name": null,
13
+ "similarity_fn_name": "cosine"
14
+ }
config_setfit.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": [
4
+ "Trigger",
5
+ "Casualty",
6
+ "Weapon"
7
+ ]
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95c79c45ab3f36cf71006e48a80c98a9711d197508e41f5ee17dfb35fe8c5757
3
+ size 133462128
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:732b2b4465f09f482ba088de92615478585bd94873cbdeb65e2cc00e65cef30f
3
+ size 11236
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,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "model_max_length": 512,
51
+ "never_split": null,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "strip_accents": null,
55
+ "tokenize_chinese_chars": true,
56
+ "tokenizer_class": "BertTokenizer",
57
+ "unk_token": "[UNK]"
58
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff