Push model using huggingface_hub.
Browse files- 1_Pooling/config.json +9 -0
- README.md +209 -0
- config.json +31 -0
- config_sentence_transformers.json +7 -0
- config_setfit.json +7 -0
- model.safetensors +3 -0
- model_head.pkl +3 -0
- modules.json +20 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +37 -0
- tokenizer.json +0 -0
- tokenizer_config.json +57 -0
- vocab.txt +0 -0
1_Pooling/config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
README.md
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: setfit
|
3 |
+
tags:
|
4 |
+
- setfit
|
5 |
+
- sentence-transformers
|
6 |
+
- text-classification
|
7 |
+
- generated_from_setfit_trainer
|
8 |
+
metrics:
|
9 |
+
- accuracy
|
10 |
+
widget:
|
11 |
+
- text: There is a man here forced us the girls in the house to have sex with him.
|
12 |
+
He took videos of us and now he is asking for money. Can someone help us?
|
13 |
+
- text: I work in textile factory. My boss, he not nice. He do things I don't like.
|
14 |
+
He make job not good, and my friends stop talk to me. I need help
|
15 |
+
- text: In Bahay Toro QC even though they did not wear face masks there was not
|
16 |
+
much news of COVID there were those who felt symptoms but self-quarantined and
|
17 |
+
there were also those who died who were told that they were COVID even though
|
18 |
+
they were not. Only a few were reported dead in the area due to COVID less than
|
19 |
+
five. During the pandemic the Barangay had curfew social distancing facemasks
|
20 |
+
and alcohol. We received SAP canned rice alcohol and facemasks and money. If
|
21 |
+
the number of COVID cases increases the barangay is not ready and when it increases that
|
22 |
+
is just the time that they will be stricter. All of us in our family were able
|
23 |
+
to be vaccinated and had booster shots apart from my younger brother. When it
|
24 |
+
tightens again and there is a pandemic unemployment and source of income will
|
25 |
+
be a test. Focus more on providing immediate assistance in the midst of a pandemic
|
26 |
+
- text: There is a child here who will be married soon. Please send help urgently.
|
27 |
+
She is only 13. It is not the first time he has done this.
|
28 |
+
- text: Drenage problem here in lilanda
|
29 |
+
pipeline_tag: text-classification
|
30 |
+
inference: true
|
31 |
+
base_model: BAAI/bge-small-en-v1.5
|
32 |
+
model-index:
|
33 |
+
- name: SetFit with BAAI/bge-small-en-v1.5
|
34 |
+
results:
|
35 |
+
- task:
|
36 |
+
type: text-classification
|
37 |
+
name: Text Classification
|
38 |
+
dataset:
|
39 |
+
name: Unknown
|
40 |
+
type: unknown
|
41 |
+
split: test
|
42 |
+
metrics:
|
43 |
+
- type: accuracy
|
44 |
+
value: 0.9827586206896551
|
45 |
+
name: Accuracy
|
46 |
+
---
|
47 |
+
|
48 |
+
# SetFit with BAAI/bge-small-en-v1.5
|
49 |
+
|
50 |
+
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 [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
|
51 |
+
|
52 |
+
The model has been trained using an efficient few-shot learning technique that involves:
|
53 |
+
|
54 |
+
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
|
55 |
+
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
56 |
+
|
57 |
+
## Model Details
|
58 |
+
|
59 |
+
### Model Description
|
60 |
+
- **Model Type:** SetFit
|
61 |
+
- **Sentence Transformer body:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
|
62 |
+
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
63 |
+
- **Maximum Sequence Length:** 512 tokens
|
64 |
+
- **Number of Classes:** 2 classes
|
65 |
+
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
66 |
+
<!-- - **Language:** Unknown -->
|
67 |
+
<!-- - **License:** Unknown -->
|
68 |
+
|
69 |
+
### Model Sources
|
70 |
+
|
71 |
+
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
|
72 |
+
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
73 |
+
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
74 |
+
|
75 |
+
### Model Labels
|
76 |
+
| Label | Examples |
|
77 |
+
|:----------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
78 |
+
| sensitive | <ul><li>'Im Amie Taylaran from Pan-ay Clarin from Solo Parent Organization grateful and excited to receive the help you are giving.'</li><li>'I want to volunteer'</li><li>'There is now a growing popular street Pennsylvania street in the annex Phase 3 of Greenland Executive Village for bikers walkers joggers every morning when the weather is fair. I presume they are groups of retirees matrons sports enthusiasts an even dance exercisers. They all wear face masks for health protection against COVID-19 infection. My concern is this: face masks are just thrown away after use when these fitness buffs are done with their morning binges. Face masks thrown on the pavement of the street the sidewalks and the grass field. Health fitness aficionados they all are but careless with the proper disposal of their face masks.'</li></ul> |
|
79 |
+
| other | <ul><li>'There is a man here forced us the girls in the house to have sex with him. He took videos of us and now he is asking for money. Can someone help us?'</li><li>'In this community alcohol abuse is rampant. The men go out drinking and come home and beat their wives. They are getting seriously injured.'</li><li>"I find myself in a very challenging situation - I've experienced sexual abuse at work. If anyone has gone through something similar, I would appreciate your guidance and support. It's tough, but we're stronger together."</li></ul> |
|
80 |
+
|
81 |
+
## Evaluation
|
82 |
+
|
83 |
+
### Metrics
|
84 |
+
| Label | Accuracy |
|
85 |
+
|:--------|:---------|
|
86 |
+
| **all** | 0.9828 |
|
87 |
+
|
88 |
+
## Uses
|
89 |
+
|
90 |
+
### Direct Use for Inference
|
91 |
+
|
92 |
+
First install the SetFit library:
|
93 |
+
|
94 |
+
```bash
|
95 |
+
pip install setfit
|
96 |
+
```
|
97 |
+
|
98 |
+
Then you can load this model and run inference.
|
99 |
+
|
100 |
+
```python
|
101 |
+
from setfit import SetFitModel
|
102 |
+
|
103 |
+
# Download from the 🤗 Hub
|
104 |
+
model = SetFitModel.from_pretrained("skylord/setfit-bge-small-v1.5-sst2-8-shot-talk2loop")
|
105 |
+
# Run inference
|
106 |
+
preds = model("Drenage problem here in lilanda")
|
107 |
+
```
|
108 |
+
|
109 |
+
<!--
|
110 |
+
### Downstream Use
|
111 |
+
|
112 |
+
*List how someone could finetune this model on their own dataset.*
|
113 |
+
-->
|
114 |
+
|
115 |
+
<!--
|
116 |
+
### Out-of-Scope Use
|
117 |
+
|
118 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
119 |
+
-->
|
120 |
+
|
121 |
+
<!--
|
122 |
+
## Bias, Risks and Limitations
|
123 |
+
|
124 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
125 |
+
-->
|
126 |
+
|
127 |
+
<!--
|
128 |
+
### Recommendations
|
129 |
+
|
130 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
131 |
+
-->
|
132 |
+
|
133 |
+
## Training Details
|
134 |
+
|
135 |
+
### Training Set Metrics
|
136 |
+
| Training set | Min | Median | Max |
|
137 |
+
|:-------------|:----|:-------|:----|
|
138 |
+
| Word count | 4 | 38.0 | 171 |
|
139 |
+
|
140 |
+
| Label | Training Sample Count |
|
141 |
+
|:----------|:----------------------|
|
142 |
+
| sensitive | 8 |
|
143 |
+
| other | 8 |
|
144 |
+
|
145 |
+
### Training Hyperparameters
|
146 |
+
- batch_size: (32, 32)
|
147 |
+
- num_epochs: (10, 10)
|
148 |
+
- max_steps: -1
|
149 |
+
- sampling_strategy: oversampling
|
150 |
+
- body_learning_rate: (2e-05, 1e-05)
|
151 |
+
- head_learning_rate: 0.01
|
152 |
+
- loss: CosineSimilarityLoss
|
153 |
+
- distance_metric: cosine_distance
|
154 |
+
- margin: 0.25
|
155 |
+
- end_to_end: False
|
156 |
+
- use_amp: False
|
157 |
+
- warmup_proportion: 0.1
|
158 |
+
- seed: 42
|
159 |
+
- eval_max_steps: -1
|
160 |
+
- load_best_model_at_end: False
|
161 |
+
|
162 |
+
### Training Results
|
163 |
+
| Epoch | Step | Training Loss | Validation Loss |
|
164 |
+
|:-----:|:----:|:-------------:|:---------------:|
|
165 |
+
| 0.2 | 1 | 0.1988 | - |
|
166 |
+
| 10.0 | 50 | 0.019 | - |
|
167 |
+
|
168 |
+
### Framework Versions
|
169 |
+
- Python: 3.10.11
|
170 |
+
- SetFit: 1.0.3
|
171 |
+
- Sentence Transformers: 2.3.1
|
172 |
+
- Transformers: 4.37.2
|
173 |
+
- PyTorch: 2.2.0+cu121
|
174 |
+
- Datasets: 2.16.1
|
175 |
+
- Tokenizers: 0.15.1
|
176 |
+
|
177 |
+
## Citation
|
178 |
+
|
179 |
+
### BibTeX
|
180 |
+
```bibtex
|
181 |
+
@article{https://doi.org/10.48550/arxiv.2209.11055,
|
182 |
+
doi = {10.48550/ARXIV.2209.11055},
|
183 |
+
url = {https://arxiv.org/abs/2209.11055},
|
184 |
+
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
|
185 |
+
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
|
186 |
+
title = {Efficient Few-Shot Learning Without Prompts},
|
187 |
+
publisher = {arXiv},
|
188 |
+
year = {2022},
|
189 |
+
copyright = {Creative Commons Attribution 4.0 International}
|
190 |
+
}
|
191 |
+
```
|
192 |
+
|
193 |
+
<!--
|
194 |
+
## Glossary
|
195 |
+
|
196 |
+
*Clearly define terms in order to be accessible across audiences.*
|
197 |
+
-->
|
198 |
+
|
199 |
+
<!--
|
200 |
+
## Model Card Authors
|
201 |
+
|
202 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
203 |
+
-->
|
204 |
+
|
205 |
+
<!--
|
206 |
+
## Model Card Contact
|
207 |
+
|
208 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
209 |
+
-->
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "BAAI/bge-small-en-v1.5",
|
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": 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 |
+
"torch_dtype": "float32",
|
27 |
+
"transformers_version": "4.37.2",
|
28 |
+
"type_vocab_size": 2,
|
29 |
+
"use_cache": true,
|
30 |
+
"vocab_size": 30522
|
31 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "2.2.2",
|
4 |
+
"transformers": "4.28.1",
|
5 |
+
"pytorch": "1.13.0+cu117"
|
6 |
+
}
|
7 |
+
}
|
config_setfit.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"normalize_embeddings": false,
|
3 |
+
"labels": [
|
4 |
+
"sensitive",
|
5 |
+
"other"
|
6 |
+
]
|
7 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f083f441e2bb85025ebb02d19ae64bcb10e98ad881677a2d6bc1b3aac5adc4d1
|
3 |
+
size 133462128
|
model_head.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:103be9afea643226753ab2e56970869296d0b50435c89155141d146051b77fff
|
3 |
+
size 3935
|
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,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"mask_token": "[MASK]",
|
49 |
+
"model_max_length": 512,
|
50 |
+
"never_split": null,
|
51 |
+
"pad_token": "[PAD]",
|
52 |
+
"sep_token": "[SEP]",
|
53 |
+
"strip_accents": null,
|
54 |
+
"tokenize_chinese_chars": true,
|
55 |
+
"tokenizer_class": "BertTokenizer",
|
56 |
+
"unk_token": "[UNK]"
|
57 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|