STEMO-SetFit / README.md
Methni's picture
Upload folder using huggingface_hub
3d63f85 verified
|
Raw
History Blame Contribute Delete
15.5 kB
---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: “යහපාලනේ” ඉහගෙන කන අප්‍රසන්න මුදල් ඇමතිගේ ලොතරැයි තියරිය pic.twitter.com/x5sHjOZ5DT
- text: අධික කෝපය නිසා පාර පුරා පිස්සු නටපු බුල්ඩෝසර රියදුරාට අවසානයේ වෙච්චි දේ! අධික-කෝපය-නිසා-පාර-පුරා-පි/
via @
- text: அண்டை மாநிலத்தில் இருக்க அவரே தமிழில் எழுதி இருக்காரு, ஒங்கலுக்கெல்லாம் என்னடா
தமிழ்ல எழுத அவமானமா இருக்கா, தமிழ் அவமானம் இல்ல, அதுதான் நம்ம அடையாளம், இந்த செயல்
நம்ம தரத்தை தாழ்த்தும், நாம் எல்லாம் தமிழன் தரங்கெட்டு போககூடாது......
- text: 'ප්‍රේම්ට දුක හිතිලා:backhand_index_pointing_down::backhand_index_pointing_down::backhand_index_pointing_down::backhand_index_pointing_down::backhand_index_pointing_down:#ලබන_ඉරිදාත_නෙත්_අහන්න_වෙලාව_හවස_4
#One_2_3_4#NETHFM #One234:check_box_with_check::microphone::OK_hand: …'
- text: அம்மா வைத்துவிடும் திருநீற்றால் எந்தக் குறையும் ஏற்பட்டுவிடாது... ஆனாலும்
அது அலகு குத்திக்கொள்ளவும் அழைத்துச் சென்றுவிடுமோ என்ற பயம் தவிர..
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
base_model: sentence-transformers/paraphrase-multilingual-mpnet-base-v2
---
# SetFit with sentence-transformers/paraphrase-multilingual-mpnet-base-v2
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-multilingual-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2) 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:** [sentence-transformers/paraphrase-multilingual-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2)
- **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:** 6 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 |
|:---------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Happy | <ul><li>'சரி பங்குக்கு மகிழ்ச்சி சொல்லுவோம். :raising_hands_medium-dark_skin_tone:'</li><li>'ජාතියක් විධියට පෘතුගාල ටිම් එක කාපු එකට සතුටු උනාට, ඔය "සිල්වා, පෙරේරා, අල්විස්" නම් තියෙන එවුන්ට ලොකු දුකක් ඇති.උන් ගැන හිතන්න එපා ඒ ඒකාලේ පෘතුග්\u200dරීසිකාරයන්ට රෙද්ද උස්සපු උන්ගේ දරුවෝ.'</li><li>'Library found the book தெய்வயோகம் is real'</li></ul> |
| Anger | <ul><li>'வைரமுத்து ஆண்டாள் சன்னதியில் மன்னிப்பு கேட்க வேண்டும் _ஜீயர்முதலில் தமிழ்த்தாய் வாழ்த்தை அவமதித்தகாஞ்சி பண்டாரநாயை தமிழ்தாய் சிலைமுன் மண்டிபோட்டு மன்னிப்பு கேட்க சொல்...'</li><li>'කෝපය කෝප්පයකට දාලා බිව්වනම් හොඳා :speak-no-evil_monkey::fire:'</li><li>'MR විදුලි පුටුවෙ ඉන්දුවට කමක් නෑ කියල. අප්\u200dරසන්නයි මචෝ. මොන දේශපාලනය කලත් ඒ තත්වෙට වටෙන්න එපා,'</li></ul> |
| Surprise | <ul><li>'இது ஆச்சரியம் தானே !பத்தில் ஒருவர் தான் ,இரவில் நிம்மதியாகத் துங்குகிறார்களாம்.-படுத்தால் தூக்கம் வராமல் தவிப்பவர்கள் ஏராளம் .'</li><li>"20 ரூ. டோக்கனுக்குப் பதிலாக, `திருநெல்வேலி அல்வா' ; ஆர்.கே.நகர்வாசிகளுக்குக் கிடைத்த அதிர்ச்சி! - Vikatan | DailyHunt …"</li><li>'Have ties with EVR family for 2 generation. அது என்னனு தெரிஞ்சிக்க ஆர்வம் தான்.'</li></ul> |
| Fear | <ul><li>'எரிஞ்சது பத்தலன்னு புகைச்சலில்ஊதிப் பெருக்க ஹரிஹர ராஜ ஷர்மா மதுரை விஜயம். மீனாட்சி அச்சம்.'</li><li>'රට යන විදිහට බය හිතෙනවා.. இது இப்படியே தொடர்ந்தால் நமக்கு எதிர்காலம் இருக்குமா?'</li><li>'அய்யா , அகோரம் இதெல்லாம் உமக்கே கோரமாக தெரியவில்லையா? :face_with_medical_mask::face_with_medical_mask:தமிழகம் பாவமய்யா.... :face_with_tears_of_joy::face_with_tears_of_joy: pic.twitter.com/ob7GeibgBD'</li></ul> |
| Sadness | <ul><li>'එදා බලද්දි හරියට දුක හිතුනා අමා. හරි අහිංසකයි තාත්තා. ඔයා වගේ දුවෙක් ලබපු එකම පිනක්'</li><li>'- ஊரே கலவரத்துல இருக்கு - மக்களுக்கு என்ன ஆச்சோ ஏது ஆச்சோ என அனைவரும் (தலைவர்கள்)கவலையில் இருக்க - இவங்களுக்கு கூட்டம் ஒரு கேடு . மக்கள் மேல அக்கரை இல்லாத இவங்க கிட்ட ஆட்சியை வேர கொடுக்கனுமாம் .. கொடுமை …'</li><li>'ලෝකයේ පවතින අනිත්\u200dය බව වටහා නොගන්නා තාක් මිනිසා දුකෙන් පීඩා විඳියි.'</li></ul> |
| Disgust | <ul><li>'මම අද උදේට බත් කාල කොලකැඳ බිවුව කියන එක එලිසමය පිහිටන්න පේලි කඩල අන්තිම වචනේ ඇදල කිවුවම ඒ මනුස්සය අපිට සිරා කවොයෙක් වෙනව. හැබැයි ෆිල් ටි ඒ විදියටම රැප් කරනව. ඒක එයාගෙ හැකියාව. ඒත් මොකක්දෝ හේතුවක් උඩ අපිට ෆිල් ටි කියන මිනිහ අප්\u200dරසන්න වෙලා තියනව.'</li><li>':grinning_face::grinning_face::grinning_face:ඒ විතරක් නෙමේ අයියෙ ඔය සේරමත් කරලා සිංහලයයි බෞද්ධාගමත් මේ රටෙන් තුරන් කරපු දවසට ඔය හිටං තවත් සතුටු වෙයි'</li><li>'ඒ උනාට කෙල්ලො බොන එක අප්\u200dරසන්නයි. (තනියම)'</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("“යහපාලනේ” ඉහගෙන කන අප්‍රසන්න මුදල් ඇමතිගේ ලොතරැයි තියරිය … pic.twitter.com/x5sHjOZ5DT")
```
<!--
### 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 | 1 | 14.9852 | 49 |
| Label | Training Sample Count |
|:---------|:----------------------|
| Happy | 182 |
| Anger | 160 |
| Sadness | 160 |
| Fear | 160 |
| Surprise | 191 |
| Disgust | 160 |
### Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 10
- body_learning_rate: (1e-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
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: True
### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0008 | 1 | 0.313 | - |
| 0.0395 | 50 | 0.2627 | - |
| 0.0789 | 100 | 0.2348 | - |
| 0.1184 | 150 | 0.1752 | - |
| 0.1579 | 200 | 0.1426 | - |
| 0.1973 | 250 | 0.1165 | - |
| 0.2368 | 300 | 0.0757 | - |
| 0.2762 | 350 | 0.0718 | - |
| 0.3157 | 400 | 0.0535 | - |
| 0.3552 | 450 | 0.0456 | - |
| 0.3946 | 500 | 0.0368 | - |
| 0.4341 | 550 | 0.0296 | - |
| 0.4736 | 600 | 0.0294 | - |
| 0.5130 | 650 | 0.0166 | - |
| 0.5525 | 700 | 0.0147 | - |
| 0.5919 | 750 | 0.006 | - |
| 0.6314 | 800 | 0.0049 | - |
| 0.6709 | 850 | 0.005 | - |
| 0.7103 | 900 | 0.0046 | - |
| 0.7498 | 950 | 0.0039 | - |
| 0.7893 | 1000 | 0.0038 | - |
| 0.8287 | 1050 | 0.0026 | - |
| 0.8682 | 1100 | 0.0024 | - |
| 0.9077 | 1150 | 0.0022 | - |
| 0.9471 | 1200 | 0.003 | - |
| 0.9866 | 1250 | 0.0013 | - |
| 1.0 | 1267 | - | 0.1362 |
### Framework Versions
- Python: 3.12.13
- SetFit: 1.1.3
- Sentence Transformers: 5.3.0
- Transformers: 4.44.2
- PyTorch: 2.10.0+cu128
- Datasets: 4.0.0
- Tokenizers: 0.19.1
## 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.*
-->