thegenerativegeneration's picture
Upload 13 files
137f54b verified
|
raw
history blame
8.35 kB
---
library_name: setfit
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
base_model: intfloat/multilingual-e5-small
metrics:
- accuracy
widget:
- text: 'query: Sí, la próxima vez que vayas, cuenta conmigo. He querido salir y hacer
más actividades en la naturaleza.'
- text: 'query: I''m man, I''m leaving now.'
- text: 'query: Ja, forse possiamo fare un giro in bicicletta insieme.'
- text: 'query: Mak saya suruh balik, jumpa lagi.'
- text: 'query: İnanılmaz, bu harika! Bir ayı gördüğüne inanamıyorum!'
pipeline_tag: text-classification
inference: true
---
# SetFit with intfloat/multilingual-e5-small
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) as the Sentence Transformer embedding model. A [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) 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:** [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small)
- **Classification head:** a [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance
- **Maximum Sequence Length:** 512 tokens
- **Number of Classes:** 2 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 |
|:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | <ul><li>'query: Tja, måste dra nu, ses senare.'</li><li>'query: Ispričavam se, moram sada otići.'</li><li>'query: Przepraszam, muszę już iść.'</li></ul> |
| 0 | <ul><li>'query: Sveiki, kā jums klājas?'</li><li>'query: அதிர்ச்சிகரமானது, அது மிகவும் அருமையாக இருக்கிறது! நீ கரடியை பார்த்தது எனக்கு நம்பிக்கையே வரவில்லை!'</li><li>'query: Ég hef það fínt, takk. Og þú?'</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("setfit_model_id")
# Run inference
preds = model("query: I'm man, I'm leaving now.")
```
<!--
### 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 | 2 | 7.6965 | 31 |
| Label | Training Sample Count |
|:------|:----------------------|
| 0 | 902 |
| 1 | 910 |
### Training Hyperparameters
- batch_size: (16, 2)
- num_epochs: (1, 16)
- max_steps: -1
- sampling_strategy: undersampling
- body_learning_rate: (1e-05, 1e-05)
- head_learning_rate: 0.001
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.1
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- seed: 42
- run_name: multilingual-e5-small
- eval_max_steps: -1
- load_best_model_at_end: True
### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0000 | 1 | 0.3613 | - |
| 0.0005 | 50 | 0.3577 | - |
| 0.0010 | 100 | 0.3511 | 0.3413 |
| 0.0015 | 150 | 0.3372 | - |
| 0.0019 | 200 | 0.3447 | 0.3347 |
| 0.0024 | 250 | 0.3349 | - |
| 0.0029 | 300 | 0.3326 | 0.3224 |
| 0.0034 | 350 | 0.3372 | - |
| 0.0039 | 400 | 0.3185 | 0.3039 |
| 0.0044 | 450 | 0.2828 | - |
| 0.0049 | 500 | 0.3055 | 0.2774 |
| 0.0054 | 550 | 0.2594 | - |
| 0.0058 | 600 | 0.2779 | 0.2489 |
| 0.0063 | 650 | 0.2486 | - |
| 0.0068 | 700 | 0.2321 | 0.22 |
| 0.0073 | 750 | 0.1838 | - |
| 0.0078 | 800 | 0.1845 | 0.2075 |
| 0.0083 | 850 | 0.1899 | - |
| 0.0088 | 900 | 0.2147 | 0.2025 |
| 0.0093 | 950 | 0.1644 | - |
| 0.0097 | 1000 | 0.2019 | 0.1821 |
| 0.0102 | 1050 | 0.2309 | - |
| 0.0107 | 1100 | 0.2084 | 0.1784 |
| 0.0112 | 1150 | 0.1508 | - |
| 0.0117 | 1200 | 0.1064 | 0.1453 |
| 0.0122 | 1250 | 0.1376 | - |
| 0.0127 | 1300 | 0.0828 | 0.121 |
| 0.0132 | 1350 | 0.1628 | - |
| 0.0136 | 1400 | 0.1308 | 0.1018 |
| 0.0141 | 1450 | 0.0566 | - |
| 0.0146 | 1500 | 0.0953 | 0.0767 |
| 0.0151 | 1550 | 0.1607 | - |
| 0.0156 | 1600 | 0.1322 | 0.0625 |
| 0.0161 | 1650 | 0.0861 | - |
| 0.0166 | 1700 | 0.0926 | 0.0423 |
| 0.0171 | 1750 | 0.0338 | - |
| 0.0175 | 1800 | 0.1029 | 0.0344 |
| 0.0180 | 1850 | 0.0442 | - |
| 0.0185 | 1900 | 0.019 | 0.0256 |
| 0.0190 | 1950 | 0.0489 | - |
| 0.0195 | 2000 | 0.0675 | 0.0187 |
### Framework Versions
- Python: 3.10.11
- SetFit: 1.0.3
- Sentence Transformers: 2.7.0
- Transformers: 4.39.0
- PyTorch: 2.4.0
- 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.*
-->