Text Classification
setfit
Joblib
Safetensors
sentence-transformers
bert
generated_from_setfit_trainer
text-embeddings-inference
Instructions to use ryeyoo/sentimentizer-router with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- setfit
How to use ryeyoo/sentimentizer-router with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("ryeyoo/sentimentizer-router") - sentence-transformers
How to use ryeyoo/sentimentizer-router with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ryeyoo/sentimentizer-router") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +114 -6
- model.safetensors +1 -1
- router_config.json +9 -0
- router_head.joblib +3 -0
README.md
CHANGED
|
@@ -4,7 +4,14 @@ tags:
|
|
| 4 |
- sentence-transformers
|
| 5 |
- text-classification
|
| 6 |
- generated_from_setfit_trainer
|
| 7 |
-
widget:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
metrics:
|
| 9 |
- accuracy
|
| 10 |
pipeline_tag: text-classification
|
|
@@ -14,7 +21,7 @@ inference: true
|
|
| 14 |
|
| 15 |
# SetFit
|
| 16 |
|
| 17 |
-
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. A
|
| 18 |
|
| 19 |
The model has been trained using an efficient few-shot learning technique that involves:
|
| 20 |
|
|
@@ -26,7 +33,7 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
| 26 |
### Model Description
|
| 27 |
- **Model Type:** SetFit
|
| 28 |
<!-- - **Sentence Transformer:** [Unknown](https://huggingface.co/unknown) -->
|
| 29 |
-
- **Classification head:** a
|
| 30 |
- **Maximum Sequence Length:** 512 tokens
|
| 31 |
- **Number of Classes:** 3 classes
|
| 32 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
|
@@ -39,6 +46,13 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
| 39 |
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
| 40 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
## Uses
|
| 43 |
|
| 44 |
### Direct Use for Inference
|
|
@@ -55,9 +69,9 @@ Then you can load this model and run inference.
|
|
| 55 |
from setfit import SetFitModel
|
| 56 |
|
| 57 |
# Download from the 🤗 Hub
|
| 58 |
-
model = SetFitModel.from_pretrained("
|
| 59 |
# Run inference
|
| 60 |
-
preds = model("
|
| 61 |
```
|
| 62 |
|
| 63 |
<!--
|
|
@@ -86,8 +100,102 @@ preds = model("I loved the spiderman movie!")
|
|
| 86 |
|
| 87 |
## Training Details
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
### Framework Versions
|
| 90 |
-
- Python: 3.
|
| 91 |
- SetFit: 1.1.3
|
| 92 |
- Sentence Transformers: 5.5.0
|
| 93 |
- Transformers: 5.8.1
|
|
|
|
| 4 |
- sentence-transformers
|
| 5 |
- text-classification
|
| 6 |
- generated_from_setfit_trainer
|
| 7 |
+
widget:
|
| 8 |
+
- text: I got the wrong food, clearly a mix-up by the server.
|
| 9 |
+
- text: The menu looked great, but the booming music meant we couldn't even discuss
|
| 10 |
+
what to order.
|
| 11 |
+
- text: We were left waiting 45 minutes beyond our booked time.
|
| 12 |
+
- text: The bartender completely understood my celiac needs and made sure my drinks
|
| 13 |
+
were safe, what great service!
|
| 14 |
+
- text: Way too loud to chat comfortably.
|
| 15 |
metrics:
|
| 16 |
- accuracy
|
| 17 |
pipeline_tag: text-classification
|
|
|
|
| 21 |
|
| 22 |
# SetFit
|
| 23 |
|
| 24 |
+
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. A NoneType instance is used for classification.
|
| 25 |
|
| 26 |
The model has been trained using an efficient few-shot learning technique that involves:
|
| 27 |
|
|
|
|
| 33 |
### Model Description
|
| 34 |
- **Model Type:** SetFit
|
| 35 |
<!-- - **Sentence Transformer:** [Unknown](https://huggingface.co/unknown) -->
|
| 36 |
+
- **Classification head:** a NoneType instance
|
| 37 |
- **Maximum Sequence Length:** 512 tokens
|
| 38 |
- **Number of Classes:** 3 classes
|
| 39 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
|
|
|
| 46 |
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
| 47 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
| 48 |
|
| 49 |
+
### Model Labels
|
| 50 |
+
| Label | Examples |
|
| 51 |
+
|:--------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 52 |
+
| general | <ul><li>"Even with the waiter's glowing recommendation, the pasta was just run-of-the-mill."</li><li>'It was an acceptable plate of pasta, just lacking that wow factor.'</li><li>'There was so much salt on the garlic bread it crunched.'</li></ul> |
|
| 53 |
+
| service | <ul><li>'So impressed by the bartender who remembered my vegan preferences and suggested perfect drinks accordingly.'</li><li>'The pace of the service was outrageously slow for a restaurant with no other guests.'</li><li>'We got the whole meal for free after telling the manager about the unacceptable wait time.'</li></ul> |
|
| 54 |
+
| dietary | <ul><li>'I ordered gluten-free bread and they brought out the regular kind by mistake.'</li><li>'My order went in so fast because the dairy-free options were impossible to miss on the menu.'</li><li>"What really impressed me wasn't just the food, but how clearly they labeled the dairy-free items."</li></ul> |
|
| 55 |
+
|
| 56 |
## Uses
|
| 57 |
|
| 58 |
### Direct Use for Inference
|
|
|
|
| 69 |
from setfit import SetFitModel
|
| 70 |
|
| 71 |
# Download from the 🤗 Hub
|
| 72 |
+
model = SetFitModel.from_pretrained("setfit_model_id")
|
| 73 |
# Run inference
|
| 74 |
+
preds = model("Way too loud to chat comfortably.")
|
| 75 |
```
|
| 76 |
|
| 77 |
<!--
|
|
|
|
| 100 |
|
| 101 |
## Training Details
|
| 102 |
|
| 103 |
+
### Training Set Metrics
|
| 104 |
+
| Training set | Min | Median | Max |
|
| 105 |
+
|:-------------|:----|:--------|:----|
|
| 106 |
+
| Word count | 4 | 12.6582 | 28 |
|
| 107 |
+
|
| 108 |
+
| Label | Training Sample Count |
|
| 109 |
+
|:--------|:----------------------|
|
| 110 |
+
| dietary | 367 |
|
| 111 |
+
| service | 416 |
|
| 112 |
+
| general | 399 |
|
| 113 |
+
|
| 114 |
+
### Training Hyperparameters
|
| 115 |
+
- batch_size: (16, 16)
|
| 116 |
+
- num_epochs: (1, 1)
|
| 117 |
+
- max_steps: -1
|
| 118 |
+
- sampling_strategy: oversampling
|
| 119 |
+
- num_iterations: 20
|
| 120 |
+
- body_learning_rate: (2e-05, 1e-05)
|
| 121 |
+
- head_learning_rate: 0.01
|
| 122 |
+
- loss: CosineSimilarityLoss
|
| 123 |
+
- distance_metric: cosine_distance
|
| 124 |
+
- margin: 0.25
|
| 125 |
+
- end_to_end: False
|
| 126 |
+
- use_amp: False
|
| 127 |
+
- warmup_proportion: 0.1
|
| 128 |
+
- l2_weight: 0.01
|
| 129 |
+
- seed: 42
|
| 130 |
+
- eval_max_steps: -1
|
| 131 |
+
- load_best_model_at_end: False
|
| 132 |
+
|
| 133 |
+
### Training Results
|
| 134 |
+
| Epoch | Step | Training Loss | Validation Loss |
|
| 135 |
+
|:------:|:----:|:-------------:|:---------------:|
|
| 136 |
+
| 0.0003 | 1 | 0.2153 | - |
|
| 137 |
+
| 0.0169 | 50 | 0.1885 | - |
|
| 138 |
+
| 0.0338 | 100 | 0.0788 | - |
|
| 139 |
+
| 0.0508 | 150 | 0.0191 | - |
|
| 140 |
+
| 0.0677 | 200 | 0.0100 | - |
|
| 141 |
+
| 0.0846 | 250 | 0.0057 | - |
|
| 142 |
+
| 0.1015 | 300 | 0.0033 | - |
|
| 143 |
+
| 0.1184 | 350 | 0.0024 | - |
|
| 144 |
+
| 0.1354 | 400 | 0.0020 | - |
|
| 145 |
+
| 0.1523 | 450 | 0.0018 | - |
|
| 146 |
+
| 0.1692 | 500 | 0.0016 | - |
|
| 147 |
+
| 0.1861 | 550 | 0.0016 | - |
|
| 148 |
+
| 0.2030 | 600 | 0.0015 | - |
|
| 149 |
+
| 0.2200 | 650 | 0.0014 | - |
|
| 150 |
+
| 0.2369 | 700 | 0.0014 | - |
|
| 151 |
+
| 0.2538 | 750 | 0.0013 | - |
|
| 152 |
+
| 0.2707 | 800 | 0.0012 | - |
|
| 153 |
+
| 0.2876 | 850 | 0.0012 | - |
|
| 154 |
+
| 0.3046 | 900 | 0.0011 | - |
|
| 155 |
+
| 0.3215 | 950 | 0.0011 | - |
|
| 156 |
+
| 0.3384 | 1000 | 0.0011 | - |
|
| 157 |
+
| 0.3553 | 1050 | 0.0011 | - |
|
| 158 |
+
| 0.3723 | 1100 | 0.0010 | - |
|
| 159 |
+
| 0.3892 | 1150 | 0.0010 | - |
|
| 160 |
+
| 0.4061 | 1200 | 0.0010 | - |
|
| 161 |
+
| 0.4230 | 1250 | 0.0009 | - |
|
| 162 |
+
| 0.4399 | 1300 | 0.0009 | - |
|
| 163 |
+
| 0.4569 | 1350 | 0.0009 | - |
|
| 164 |
+
| 0.4738 | 1400 | 0.0008 | - |
|
| 165 |
+
| 0.4907 | 1450 | 0.0009 | - |
|
| 166 |
+
| 0.5076 | 1500 | 0.0008 | - |
|
| 167 |
+
| 0.5245 | 1550 | 0.0009 | - |
|
| 168 |
+
| 0.5415 | 1600 | 0.0008 | - |
|
| 169 |
+
| 0.5584 | 1650 | 0.0008 | - |
|
| 170 |
+
| 0.5753 | 1700 | 0.0008 | - |
|
| 171 |
+
| 0.5922 | 1750 | 0.0008 | - |
|
| 172 |
+
| 0.6091 | 1800 | 0.0008 | - |
|
| 173 |
+
| 0.6261 | 1850 | 0.0008 | - |
|
| 174 |
+
| 0.6430 | 1900 | 0.0008 | - |
|
| 175 |
+
| 0.6599 | 1950 | 0.0007 | - |
|
| 176 |
+
| 0.6768 | 2000 | 0.0008 | - |
|
| 177 |
+
| 0.6937 | 2050 | 0.0008 | - |
|
| 178 |
+
| 0.7107 | 2100 | 0.0008 | - |
|
| 179 |
+
| 0.7276 | 2150 | 0.0007 | - |
|
| 180 |
+
| 0.7445 | 2200 | 0.0007 | - |
|
| 181 |
+
| 0.7614 | 2250 | 0.0007 | - |
|
| 182 |
+
| 0.7783 | 2300 | 0.0007 | - |
|
| 183 |
+
| 0.7953 | 2350 | 0.0007 | - |
|
| 184 |
+
| 0.8122 | 2400 | 0.0007 | - |
|
| 185 |
+
| 0.8291 | 2450 | 0.0007 | - |
|
| 186 |
+
| 0.8460 | 2500 | 0.0007 | - |
|
| 187 |
+
| 0.8629 | 2550 | 0.0007 | - |
|
| 188 |
+
| 0.8799 | 2600 | 0.0007 | - |
|
| 189 |
+
| 0.8968 | 2650 | 0.0007 | - |
|
| 190 |
+
| 0.9137 | 2700 | 0.0007 | - |
|
| 191 |
+
| 0.9306 | 2750 | 0.0007 | - |
|
| 192 |
+
| 0.9475 | 2800 | 0.0006 | - |
|
| 193 |
+
| 0.9645 | 2850 | 0.0007 | - |
|
| 194 |
+
| 0.9814 | 2900 | 0.0007 | - |
|
| 195 |
+
| 0.9983 | 2950 | 0.0007 | - |
|
| 196 |
+
|
| 197 |
### Framework Versions
|
| 198 |
+
- Python: 3.11.15
|
| 199 |
- SetFit: 1.1.3
|
| 200 |
- Sentence Transformers: 5.5.0
|
| 201 |
- Transformers: 5.8.1
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 437951328
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c95c94cc21266cf59a1a0f8275854c39ec8d874b5a57954972ebd84ced0a91d2
|
| 3 |
size 437951328
|
router_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "router",
|
| 3 |
+
"labels": [
|
| 4 |
+
"dietary",
|
| 5 |
+
"service",
|
| 6 |
+
"general"
|
| 7 |
+
],
|
| 8 |
+
"head_type": "LogisticRegression"
|
| 9 |
+
}
|
router_head.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:39187cbdc3e9ef6f7f9383c4984af9736f3afcb61f205206695f2e8c11aa6c3e
|
| 3 |
+
size 19327
|