
# SetFit with lighteternal/stsb-xlm-r-greek-transfer

This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [ethos](https://huggingface.co/datasets/ethos) dataset that can be used for Text Classification. This SetFit model uses [lighteternal/stsb-xlm-r-greek-transfer](https://huggingface.co/lighteternal/stsb-xlm-r-greek-transfer) as the Sentence Transformer embedding model. A OneVsRestClassifier instance is used for classification.

The model has been trained using an efficient few-shot learning technique that involves:

1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
2. Training a classification head with features from the fine-tuned Sentence Transformer.

## Model Details

### Model Description
- **Model Type:** SetFit
- **Sentence Transformer body:** [lighteternal/stsb-xlm-r-greek-transfer](https://huggingface.co/lighteternal/stsb-xlm-r-greek-transfer)
- **Classification head:** a OneVsRestClassifier instance
- **Maximum Sequence Length:** 400 tokens
<!-- - **Number of Classes:** Unknown -->
- **Training Dataset:** [ethos](https://huggingface.co/datasets/ethos)
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)

## Evaluation

### Metrics
| Label   | Accuracy |
|:--------|:---------|
| **all** | 0.1906   |

## Uses

### Direct Use for Inference

First install the SetFit library:

```bash
pip install setfit
```

Then you can load this model and run inference.

```python
from setfit import SetFitModel

# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("st-karlos-efood/setfit-multilabel-example")
# Run inference
preds = model("We have to take our power back as the superior gender. ")
```

<!--
### Downstream Use

*List how someone could finetune this model on their own dataset.*
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Set Metrics
| Training set | Min | Median  | Max |
|:-------------|:----|:--------|:----|
| Word count   | 3   | 10.0963 | 61  |

### Training Hyperparameters
- batch_size: (32, 32)
- num_epochs: (5, 5)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 10
- body_learning_rate: (2e-05, 2e-05)
- head_learning_rate: 2e-05
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False

### Training Results
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0006 | 1    | 0.2007        | -               |
| 0.0296 | 50   | 0.1943        | -               |
| 0.0592 | 100  | 0.1319        | -               |
| 0.0888 | 150  | 0.1389        | -               |
| 0.1184 | 200  | 0.1251        | -               |
| 0.1480 | 250  | 0.1142        | -               |
| 0.1776 | 300  | 0.2009        | -               |
| 0.2072 | 350  | 0.1296        | -               |
| 0.2368 | 400  | 0.0941        | -               |
| 0.2664 | 450  | 0.1763        | -               |
| 0.2960 | 500  | 0.0949        | -               |
| 0.3256 | 550  | 0.1334        | -               |
| 0.3552 | 600  | 0.0715        | -               |
| 0.3848 | 650  | 0.1213        | -               |
| 0.4144 | 700  | 0.1713        | -               |
| 0.4440 | 750  | 0.1495        | -               |
| 0.4737 | 800  | 0.047         | -               |
| 0.5033 | 850  | 0.1554        | -               |
| 0.5329 | 900  | 0.1222        | -               |
| 0.5625 | 950  | 0.0939        | -               |
| 0.5921 | 1000 | 0.1142        | -               |
| 0.6217 | 1050 | 0.1451        | -               |
| 0.6513 | 1100 | 0.1044        | -               |
| 0.6809 | 1150 | 0.0777        | -               |
| 0.7105 | 1200 | 0.1038        | -               |
| 0.7401 | 1250 | 0.0978        | -               |
| 0.7697 | 1300 | 0.0871        | -               |
| 0.7993 | 1350 | 0.0748        | -               |
| 0.8289 | 1400 | 0.0646        | -               |
| 0.8585 | 1450 | 0.063         | -               |
| 0.8881 | 1500 | 0.0925        | -               |
| 0.9177 | 1550 | 0.0947        | -               |
| 0.9473 | 1600 | 0.0898        | -               |
| 0.9769 | 1650 | 0.1361        | -               |
| 1.0065 | 1700 | 0.0534        | -               |
| 1.0361 | 1750 | 0.119         | -               |
| 1.0657 | 1800 | 0.0925        | -               |
| 1.0953 | 1850 | 0.0752        | -               |
| 1.1249 | 1900 | 0.1151        | -               |
| 1.1545 | 1950 | 0.1259        | -               |
| 1.1841 | 2000 | 0.1265        | -               |
| 1.2137 | 2050 | 0.09          | -               |
| 1.2433 | 2100 | 0.0787        | -               |
| 1.2729 | 2150 | 0.0562        | -               |
| 1.3025 | 2200 | 0.0657        | -               |
| 1.3321 | 2250 | 0.1115        | -               |
| 1.3618 | 2300 | 0.0773        | -               |
| 1.3914 | 2350 | 0.086         | -               |
| 1.4210 | 2400 | 0.0507        | -               |
| 1.4506 | 2450 | 0.0978        | -               |
| 1.4802 | 2500 | 0.1313        | -               |
| 1.5098 | 2550 | 0.111         | -               |
| 1.5394 | 2600 | 0.0757        | -               |
| 1.5690 | 2650 | 0.0774        | -               |
| 1.5986 | 2700 | 0.0623        | -               |
| 1.6282 | 2750 | 0.0795        | -               |
| 1.6578 | 2800 | 0.0745        | -               |
| 1.6874 | 2850 | 0.0423        | -               |
| 1.7170 | 2900 | 0.112         | -               |
| 1.7466 | 2950 | 0.1884        | -               |
| 1.7762 | 3000 | 0.0848        | -               |
| 1.8058 | 3050 | 0.0954        | -               |
| 1.8354 | 3100 | 0.0661        | -               |
| 1.8650 | 3150 | 0.0908        | -               |
| 1.8946 | 3200 | 0.0516        | -               |
| 1.9242 | 3250 | 0.0534        | -               |
| 1.9538 | 3300 | 0.088         | -               |
| 1.9834 | 3350 | 0.1468        | -               |
| 2.0130 | 3400 | 0.0758        | -               |
| 2.0426 | 3450 | 0.0779        | -               |
| 2.0722 | 3500 | 0.0604        | -               |
| 2.1018 | 3550 | 0.0824        | -               |
| 2.1314 | 3600 | 0.1128        | -               |
| 2.1610 | 3650 | 0.0872        | -               |
| 2.1906 | 3700 | 0.1358        | -               |
| 2.2202 | 3750 | 0.1114        | -               |
| 2.2499 | 3800 | 0.0678        | -               |
| 2.2795 | 3850 | 0.0825        | -               |
| 2.3091 | 3900 | 0.0897        | -               |
| 2.3387 | 3950 | 0.1174        | -               |
| 2.3683 | 4000 | 0.0974        | -               |
| 2.3979 | 4050 | 0.0637        | -               |
| 2.4275 | 4100 | 0.1029        | -               |
| 2.4571 | 4150 | 0.081         | -               |
| 2.4867 | 4200 | 0.0665        | -               |
| 2.5163 | 4250 | 0.0581        | -               |
| 2.5459 | 4300 | 0.0868        | -               |
| 2.5755 | 4350 | 0.0281        | -               |
| 2.6051 | 4400 | 0.1278        | -               |
| 2.6347 | 4450 | 0.0779        | -               |
| 2.6643 | 4500 | 0.1008        | -               |
| 2.6939 | 4550 | 0.0512        | -               |
| 2.7235 | 4600 | 0.158         | -               |
| 2.7531 | 4650 | 0.1045        | -               |
| 2.7827 | 4700 | 0.0661        | -               |
| 2.8123 | 4750 | 0.1127        | -               |
| 2.8419 | 4800 | 0.1061        | -               |
| 2.8715 | 4850 | 0.066         | -               |
| 2.9011 | 4900 | 0.1012        | -               |
| 2.9307 | 4950 | 0.1228        | -               |
| 2.9603 | 5000 | 0.0494        | -               |
| 2.9899 | 5050 | 0.1025        | -               |
| 3.0195 | 5100 | 0.0876        | -               |
| 3.0491 | 5150 | 0.095         | -               |
| 3.0787 | 5200 | 0.0932        | -               |
| 3.1083 | 5250 | 0.118         | -               |
| 3.1380 | 5300 | 0.0947        | -               |
| 3.1676 | 5350 | 0.0775        | -               |
| 3.1972 | 5400 | 0.0639        | -               |
| 3.2268 | 5450 | 0.0726        | -               |
| 3.2564 | 5500 | 0.0801        | -               |
| 3.2860 | 5550 | 0.0926        | -               |
| 3.3156 | 5600 | 0.1011        | -               |
| 3.3452 | 5650 | 0.0634        | -               |
| 3.3748 | 5700 | 0.062         | -               |
| 3.4044 | 5750 | 0.1043        | -               |
| 3.4340 | 5800 | 0.0801        | -               |
| 3.4636 | 5850 | 0.0379        | -               |
| 3.4932 | 5900 | 0.0727        | -               |
| 3.5228 | 5950 | 0.0957        | -               |
| 3.5524 | 6000 | 0.0789        | -               |
| 3.5820 | 6050 | 0.0382        | -               |
| 3.6116 | 6100 | 0.1333        | -               |
| 3.6412 | 6150 | 0.126         | -               |
| 3.6708 | 6200 | 0.0676        | -               |
| 3.7004 | 6250 | 0.1133        | -               |
| 3.7300 | 6300 | 0.1226        | -               |
| 3.7596 | 6350 | 0.0906        | -               |
| 3.7892 | 6400 | 0.072         | -               |
| 3.8188 | 6450 | 0.08          | -               |
| 3.8484 | 6500 | 0.0332        | -               |
| 3.8780 | 6550 | 0.0704        | -               |
| 3.9076 | 6600 | 0.0575        | -               |
| 3.9372 | 6650 | 0.0599        | -               |
| 3.9668 | 6700 | 0.0636        | -               |
| 3.9964 | 6750 | 0.1168        | -               |
| 4.0261 | 6800 | 0.0887        | -               |
| 4.0557 | 6850 | 0.0626        | -               |
| 4.0853 | 6900 | 0.0651        | -               |
| 4.1149 | 6950 | 0.0928        | -               |
| 4.1445 | 7000 | 0.0597        | -               |
| 4.1741 | 7050 | 0.0727        | -               |
| 4.2037 | 7100 | 0.0707        | -               |
| 4.2333 | 7150 | 0.0674        | -               |
| 4.2629 | 7200 | 0.1094        | -               |
| 4.2925 | 7250 | 0.0599        | -               |
| 4.3221 | 7300 | 0.0776        | -               |
| 4.3517 | 7350 | 0.1156        | -               |
| 4.3813 | 7400 | 0.0913        | -               |
| 4.4109 | 7450 | 0.0859        | -               |
| 4.4405 | 7500 | 0.0985        | -               |
| 4.4701 | 7550 | 0.1105        | -               |
| 4.4997 | 7600 | 0.0555        | -               |
| 4.5293 | 7650 | 0.0532        | -               |
| 4.5589 | 7700 | 0.0411        | -               |
| 4.5885 | 7750 | 0.118         | -               |
| 4.6181 | 7800 | 0.0672        | -               |
| 4.6477 | 7850 | 0.06          | -               |
| 4.6773 | 7900 | 0.1082        | -               |
| 4.7069 | 7950 | 0.1538        | -               |
| 4.7365 | 8000 | 0.0527        | -               |
| 4.7661 | 8050 | 0.074         | -               |
| 4.7957 | 8100 | 0.0465        | -               |
| 4.8253 | 8150 | 0.083         | -               |
| 4.8549 | 8200 | 0.0743        | -               |
| 4.8845 | 8250 | 0.0644        | -               |
| 4.9142 | 8300 | 0.0792        | -               |
| 4.9438 | 8350 | 0.0729        | -               |
| 4.9734 | 8400 | 0.0868        | -               |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.0.3
- Sentence Transformers: 2.2.2
- Transformers: 4.35.2
- PyTorch: 2.1.0+cu121
- Datasets: 2.16.1
- Tokenizers: 0.15.0

## Citation

### BibTeX
```bibtex
@article{https://doi.org/10.48550/arxiv.2209.11055,
    doi = {10.48550/ARXIV.2209.11055},
    url = {https://arxiv.org/abs/2209.11055},
    author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
    keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
    title = {Efficient Few-Shot Learning Without Prompts},
    publisher = {arXiv},
    year = {2022},
    copyright = {Creative Commons Attribution 4.0 International}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->
{"library_name": "setfit", "tags": ["setfit", "sentence-transformers", "text-classification", "generated_from_setfit_trainer"], "datasets": ["ethos"], "metrics": ["accuracy"], "widget": [{"text": "We have to take our power back as the superior gender. "}, {"text": "Weak beta male, hope he turns into a tranny after this traumatic experience, haha"}, {"text": "Hello I'm calling from tech support *with Indian accent*"}, {"text": "I like big thick bitches to serve me my cocktail. They are good only for such things"}, {"text": "Generally speaking, most women are lazy and worthless not all, but most."}], "pipeline_tag": "text-classification", "inference": false, "base_model": "lighteternal/stsb-xlm-r-greek-transfer", "model-index": [{"name": "SetFit with lighteternal/stsb-xlm-r-greek-transfer", "results": [{"task": {"type": "text-classification", "name": "Text Classification"}, "dataset": {"name": "ethos", "type": "ethos", "split": "test"}, "metrics": [{"type": "accuracy", "value": 0.19063545150501673, "name": "Accuracy"}]}]}]}
setfit safetensors xlm-roberta sentence-transformers text-classification generated_from_setfit_trainer dataset:ethos arxiv:2209.11055 base_model:lighteternal/stsb-xlm-r-greek-transfer model-index region:us