Add SetFit model
Browse files- README.md +80 -3
- config.json +1 -1
- config_setfit.json +2 -2
- model.safetensors +1 -1
- model_head.pkl +2 -2
README.md
CHANGED
@@ -7,10 +7,40 @@ tags:
|
|
7 |
- generated_from_setfit_trainer
|
8 |
metrics:
|
9 |
- accuracy
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
pipeline_tag: text-classification
|
12 |
inference: true
|
13 |
base_model: sentence-transformers/paraphrase-mpnet-base-v2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
---
|
15 |
|
16 |
# SetFit with sentence-transformers/paraphrase-mpnet-base-v2
|
@@ -29,7 +59,7 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
29 |
- **Sentence Transformer body:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
|
30 |
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
31 |
- **Maximum Sequence Length:** 512 tokens
|
32 |
-
|
33 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
34 |
<!-- - **Language:** Unknown -->
|
35 |
<!-- - **License:** Unknown -->
|
@@ -40,6 +70,19 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
40 |
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
41 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
## Uses
|
44 |
|
45 |
### Direct Use for Inference
|
@@ -58,7 +101,7 @@ from setfit import SetFitModel
|
|
58 |
# Download from the 🤗 Hub
|
59 |
model = SetFitModel.from_pretrained("setfit_model_id")
|
60 |
# Run inference
|
61 |
-
preds = model("
|
62 |
```
|
63 |
|
64 |
<!--
|
@@ -87,6 +130,40 @@ preds = model("I loved the spiderman movie!")
|
|
87 |
|
88 |
## Training Details
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
### Framework Versions
|
91 |
- Python: 3.11.0
|
92 |
- SetFit: 1.0.3
|
|
|
7 |
- generated_from_setfit_trainer
|
8 |
metrics:
|
9 |
- accuracy
|
10 |
+
- precision
|
11 |
+
- recall
|
12 |
+
- f1
|
13 |
+
widget:
|
14 |
+
- text: 'Recognized as one of the Most Energy Efficient Dealerships in North America! '
|
15 |
+
- text: 'Nespresso VertuoLine WS Keurig 2.0 '
|
16 |
+
- text: Threat Intelligence & Brand Reputation
|
17 |
+
- text: 'FpeANUTOUTTER- CUPS '
|
18 |
pipeline_tag: text-classification
|
19 |
inference: true
|
20 |
base_model: sentence-transformers/paraphrase-mpnet-base-v2
|
21 |
+
model-index:
|
22 |
+
- name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2
|
23 |
+
results:
|
24 |
+
- task:
|
25 |
+
type: text-classification
|
26 |
+
name: Text Classification
|
27 |
+
dataset:
|
28 |
+
name: Unknown
|
29 |
+
type: unknown
|
30 |
+
split: test
|
31 |
+
metrics:
|
32 |
+
- type: accuracy
|
33 |
+
value: 1.0
|
34 |
+
name: Accuracy
|
35 |
+
- type: precision
|
36 |
+
value: 1.0
|
37 |
+
name: Precision
|
38 |
+
- type: recall
|
39 |
+
value: 1.0
|
40 |
+
name: Recall
|
41 |
+
- type: f1
|
42 |
+
value: 1.0
|
43 |
+
name: F1
|
44 |
---
|
45 |
|
46 |
# SetFit with sentence-transformers/paraphrase-mpnet-base-v2
|
|
|
59 |
- **Sentence Transformer body:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
|
60 |
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
61 |
- **Maximum Sequence Length:** 512 tokens
|
62 |
+
- **Number of Classes:** 2 classes
|
63 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
64 |
<!-- - **Language:** Unknown -->
|
65 |
<!-- - **License:** Unknown -->
|
|
|
70 |
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
71 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
72 |
|
73 |
+
### Model Labels
|
74 |
+
| Label | Examples |
|
75 |
+
|:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
76 |
+
| True | <ul><li>'Solve lunch first. Introducing The 12™, made with seasoned Canadian chicken breast, fresh tomato and crisp lettuce. '</li><li>'MAKE THE MOST OF _ Notional Ube Chocoleté Diy '</li><li>'ee ee Ra bere car 100% nisared } Bon ard whist riekes is wo ire. Ta fag eesti eas nen Pa asered, hoathy and hing groen with every sip of Potand Spring? Grand 100% Natural Spring Warler you eqioy. '</li></ul> |
|
77 |
+
| False | <ul><li>'Wykorzystywanie ograniczonych danych do wyboru treści '</li><li>'GitHub'</li><li>'Draftsmen'</li></ul> |
|
78 |
+
|
79 |
+
## Evaluation
|
80 |
+
|
81 |
+
### Metrics
|
82 |
+
| Label | Accuracy | Precision | Recall | F1 |
|
83 |
+
|:--------|:---------|:----------|:-------|:----|
|
84 |
+
| **all** | 1.0 | 1.0 | 1.0 | 1.0 |
|
85 |
+
|
86 |
## Uses
|
87 |
|
88 |
### Direct Use for Inference
|
|
|
101 |
# Download from the 🤗 Hub
|
102 |
model = SetFitModel.from_pretrained("setfit_model_id")
|
103 |
# Run inference
|
104 |
+
preds = model("FpeANUTOUTTER- CUPS ")
|
105 |
```
|
106 |
|
107 |
<!--
|
|
|
130 |
|
131 |
## Training Details
|
132 |
|
133 |
+
### Training Set Metrics
|
134 |
+
| Training set | Min | Median | Max |
|
135 |
+
|:-------------|:----|:-------|:----|
|
136 |
+
| Word count | 1 | 7.5625 | 41 |
|
137 |
+
|
138 |
+
| Label | Training Sample Count |
|
139 |
+
|:------|:----------------------|
|
140 |
+
| False | 9 |
|
141 |
+
| True | 7 |
|
142 |
+
|
143 |
+
### Training Hyperparameters
|
144 |
+
- batch_size: (16, 2)
|
145 |
+
- num_epochs: (1, 16)
|
146 |
+
- max_steps: -1
|
147 |
+
- sampling_strategy: oversampling
|
148 |
+
- num_iterations: 20
|
149 |
+
- body_learning_rate: (2e-05, 1e-05)
|
150 |
+
- head_learning_rate: 0.01
|
151 |
+
- loss: CosineSimilarityLoss
|
152 |
+
- distance_metric: cosine_distance
|
153 |
+
- margin: 0.25
|
154 |
+
- end_to_end: False
|
155 |
+
- use_amp: False
|
156 |
+
- warmup_proportion: 0.1
|
157 |
+
- seed: 42
|
158 |
+
- run_name: PG-OCR-test-3
|
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.025 | 1 | 0.027 | - |
|
166 |
+
|
167 |
### Framework Versions
|
168 |
- Python: 3.11.0
|
169 |
- SetFit: 1.0.3
|
config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "
|
3 |
"architectures": [
|
4 |
"MPNetModel"
|
5 |
],
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "./checkpoints/step_40000",
|
3 |
"architectures": [
|
4 |
"MPNetModel"
|
5 |
],
|
config_setfit.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
"
|
4 |
}
|
|
|
1 |
{
|
2 |
+
"labels": null,
|
3 |
+
"normalize_embeddings": false
|
4 |
}
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 437967672
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:89f5739a71defce2ac7dec21880b882bda50bb113142bc8aa2e84c888cfed3d0
|
3 |
size 437967672
|
model_head.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8b6921bc7c043fff49732928e715283280385477f91eac02d750811a2262cbc5
|
3 |
+
size 6991
|