setfitemotions / README.md
adriansanz's picture
Add SetFit model
cbc2fb7 verified
---
base_model: projecte-aina/ST-NLI-ca_paraphrase-multilingual-mpnet-base
library_name: setfit
metrics:
- accuracy
pipeline_tag: text-classification
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: Aquest text és Varis
- text: Aquest text és Mobiliari Urbà
- text: Aquest text és Velocitat
- text: Aquest text és Parcs i Jardins
- text: Aquest text és Enllumenat
inference: true
---
# SetFit with projecte-aina/ST-NLI-ca_paraphrase-multilingual-mpnet-base
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [projecte-aina/ST-NLI-ca_paraphrase-multilingual-mpnet-base](https://huggingface.co/projecte-aina/ST-NLI-ca_paraphrase-multilingual-mpnet-base) 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.
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:** [projecte-aina/ST-NLI-ca_paraphrase-multilingual-mpnet-base](https://huggingface.co/projecte-aina/ST-NLI-ca_paraphrase-multilingual-mpnet-base)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 128 tokens
- **Number of Classes:** 14 classes
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
<!-- - **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)
### Model Labels
| Label | Examples |
|:------|:-------------------------------------------------------------------------------------------------------------------------------------|
| 0 | <ul><li>'Aquest text és Arbrat'</li><li>'Aquest text és Arbrat'</li><li>'Aquest text és Arbrat'</li></ul> |
| 1 | <ul><li>'Aquest text és Circulació'</li><li>'Aquest text és Circulació'</li><li>'Aquest text és Circulació'</li></ul> |
| 2 | <ul><li>'Aquest text és Comentaris'</li><li>'Aquest text és Comentaris'</li><li>'Aquest text és Comentaris'</li></ul> |
| 3 | <ul><li>'Aquest text és Enllumenat'</li><li>'Aquest text és Enllumenat'</li><li>'Aquest text és Enllumenat'</li></ul> |
| 4 | <ul><li>'Aquest text és Informació'</li><li>'Aquest text és Informació'</li><li>'Aquest text és Informació'</li></ul> |
| 5 | <ul><li>'Aquest text és Manteniment'</li><li>'Aquest text és Manteniment'</li><li>'Aquest text és Manteniment'</li></ul> |
| 6 | <ul><li>'Aquest text és Mobiliari Urbà'</li><li>'Aquest text és Mobiliari Urbà'</li><li>'Aquest text és Mobiliari Urbà'</li></ul> |
| 7 | <ul><li>'Aquest text és Neteja'</li><li>'Aquest text és Neteja'</li><li>'Aquest text és Neteja'</li></ul> |
| 8 | <ul><li>'Aquest text és Parcs i Jardins'</li><li>'Aquest text és Parcs i Jardins'</li><li>'Aquest text és Parcs i Jardins'</li></ul> |
| 9 | <ul><li>'Aquest text és Senyalització'</li><li>'Aquest text és Senyalització'</li><li>'Aquest text és Senyalització'</li></ul> |
| 10 | <ul><li>'Aquest text és Sorolls'</li><li>'Aquest text és Sorolls'</li><li>'Aquest text és Sorolls'</li></ul> |
| 11 | <ul><li>'Aquest text és Suggeriments'</li><li>'Aquest text és Suggeriments'</li><li>'Aquest text és Suggeriments'</li></ul> |
| 12 | <ul><li>'Aquest text és Varis'</li><li>'Aquest text és Varis'</li><li>'Aquest text és Varis'</li></ul> |
| 13 | <ul><li>'Aquest text és Velocitat'</li><li>'Aquest text és Velocitat'</li><li>'Aquest text és Velocitat'</li></ul> |
## 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("adriansanz/setfitemotions")
# Run inference
preds = model("Aquest text és Varis")
```
<!--
### 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 | 4 | 4.2143 | 6 |
| Label | Training Sample Count |
|:------|:----------------------|
| 0 | 10 |
| 1 | 10 |
| 2 | 10 |
| 3 | 10 |
| 4 | 10 |
| 5 | 10 |
| 6 | 10 |
| 7 | 10 |
| 8 | 10 |
| 9 | 10 |
| 10 | 10 |
| 11 | 10 |
| 12 | 10 |
| 13 | 10 |
### Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (3, 3)
- max_steps: -1
- sampling_strategy: oversampling
- body_learning_rate: (2e-05, 1e-05)
- head_learning_rate: 0.01
- 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: True
### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0009 | 1 | 0.2021 | - |
| 0.0439 | 50 | 0.0263 | - |
| 0.0879 | 100 | 0.0032 | - |
| 0.1318 | 150 | 0.0015 | - |
| 0.1757 | 200 | 0.0012 | - |
| 0.2197 | 250 | 0.0007 | - |
| 0.2636 | 300 | 0.0008 | - |
| 0.3076 | 350 | 0.0006 | - |
| 0.3515 | 400 | 0.0003 | - |
| 0.3954 | 450 | 0.0003 | - |
| 0.4394 | 500 | 0.0004 | - |
| 0.4833 | 550 | 0.0005 | - |
| 0.5272 | 600 | 0.0004 | - |
| 0.5712 | 650 | 0.0005 | - |
| 0.6151 | 700 | 0.0005 | - |
| 0.6591 | 750 | 0.0002 | - |
| 0.7030 | 800 | 0.0001 | - |
| 0.7469 | 850 | 0.0004 | - |
| 0.7909 | 900 | 0.0002 | - |
| 0.8348 | 950 | 0.0003 | - |
| 0.8787 | 1000 | 0.0002 | - |
| 0.9227 | 1050 | 0.0002 | - |
| 0.9666 | 1100 | 0.0003 | - |
| 1.0105 | 1150 | 0.0002 | - |
| 1.0545 | 1200 | 0.0002 | - |
| 1.0984 | 1250 | 0.0002 | - |
| 1.1424 | 1300 | 0.0003 | - |
| 1.1863 | 1350 | 0.0003 | - |
| 1.2302 | 1400 | 0.0001 | - |
| 1.2742 | 1450 | 0.0002 | - |
| 1.3181 | 1500 | 0.0001 | - |
| 1.3620 | 1550 | 0.0001 | - |
| 1.4060 | 1600 | 0.0003 | - |
| 1.4499 | 1650 | 0.0001 | - |
| 1.4938 | 1700 | 0.0001 | - |
| 1.5378 | 1750 | 0.0001 | - |
| 1.5817 | 1800 | 0.0001 | - |
| 1.6257 | 1850 | 0.0001 | - |
| 1.6696 | 1900 | 0.0001 | - |
| 1.7135 | 1950 | 0.0001 | - |
| 1.7575 | 2000 | 0.0002 | - |
| 1.8014 | 2050 | 0.0001 | - |
| 1.8453 | 2100 | 0.0001 | - |
| 1.8893 | 2150 | 0.0002 | - |
| 1.9332 | 2200 | 0.0001 | - |
| 1.9772 | 2250 | 0.0002 | - |
| 2.0211 | 2300 | 0.0001 | - |
| 2.0650 | 2350 | 0.0001 | - |
| 2.1090 | 2400 | 0.0001 | - |
| 2.1529 | 2450 | 0.0001 | - |
| 2.1968 | 2500 | 0.0001 | - |
| 2.2408 | 2550 | 0.0001 | - |
| 2.2847 | 2600 | 0.0 | - |
| 2.3286 | 2650 | 0.0001 | - |
| 2.3726 | 2700 | 0.0001 | - |
| 2.4165 | 2750 | 0.0001 | - |
| 2.4605 | 2800 | 0.0001 | - |
| 2.5044 | 2850 | 0.0001 | - |
| 2.5483 | 2900 | 0.0001 | - |
| 2.5923 | 2950 | 0.0001 | - |
| 2.6362 | 3000 | 0.0001 | - |
| 2.6801 | 3050 | 0.0001 | - |
| 2.7241 | 3100 | 0.0001 | - |
| 2.7680 | 3150 | 0.0001 | - |
| 2.8120 | 3200 | 0.0001 | - |
| 2.8559 | 3250 | 0.0001 | - |
| 2.8998 | 3300 | 0.0001 | - |
| 2.9438 | 3350 | 0.0001 | - |
| 2.9877 | 3400 | 0.0001 | - |
### Framework Versions
- Python: 3.10.12
- SetFit: 1.0.3
- Sentence Transformers: 3.0.1
- Transformers: 4.39.0
- PyTorch: 2.3.1+cu121
- Datasets: 2.20.0
- Tokenizers: 0.15.2
## 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.*
-->