Text Classification
setfit
Safetensors
sentence-transformers
xlm-roberta
generated_from_setfit_trainer
text-embeddings-inference
Instructions to use Methni/STEMO-SetFit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- setfit
How to use Methni/STEMO-SetFit with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("Methni/STEMO-SetFit") - sentence-transformers
How to use Methni/STEMO-SetFit with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Methni/STEMO-SetFit") 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
metadata
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 model that can be used for Text Classification. This SetFit model uses sentence-transformers/paraphrase-multilingual-mpnet-base-v2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
- Fine-tuning a Sentence Transformer with contrastive learning.
- 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
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 128 tokens
- Number of Classes: 6 classes
Model Sources
- Repository: SetFit on GitHub
- Paper: Efficient Few-Shot Learning Without Prompts
- Blogpost: SetFit: Efficient Few-Shot Learning Without Prompts
Model Labels
| Label | Examples |
|---|---|
| Happy |
|
| Anger |
|
| Surprise |
|
| Fear |
|
| Sadness |
|
| Disgust |
|
Uses
Direct Use for Inference
First install the SetFit library:
pip install setfit
Then you can load this model and run inference.
from setfit import SetFitModel
# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("setfit_model_id")
# Run inference
preds = model("“යහපාලනේ” ඉහගෙන කන අප්රසන්න මුදල් ඇමතිගේ ලොතරැයි තියරිය … pic.twitter.com/x5sHjOZ5DT")
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
@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}
}