metadata
library_name: setfit
tags:
- setfit
- absa
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
base_model: cointegrated/rubert-tiny2
metrics:
- accuracy
widget:
- text: >-
Посетили вчера Твинс с подругой ,:Посетили вчера Твинс с подругой , в
целом все очень понравилось ! !
- text: >-
, что это кафе для тех ,:По кухне можно сказать , что это кафе для тех ,
кто любит соотношение цены и качества .
- text: >-
особенно шашлыки и наполеон . ( спасибо:Готовят очень вкусно , особенно
шашлыки и наполеон . ( спасибо большое поварам )
- text: >-
свет , ненавязчивая музыка ( даже как:Интерьер приятный : есть гардероб ,
диваны , приглушенный свет , ненавязчивая музыка ( даже как - то раз
наткнулись там на саксофониста ) , приятная атмосфера . . .
- text: >-
отдельно : есть официанты , которые работают:По обслуживание отдельно :
есть официанты , которые работают с самого открытия - это тоже неплохой
показатель качества .
pipeline_tag: text-classification
inference: false
SetFit Polarity Model with cointegrated/rubert-tiny2
This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses cointegrated/rubert-tiny2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification. In particular, this model is in charge of classifying aspect polarities.
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.
This model was trained within the context of a larger system for ABSA, which looks like so:
- Use a spaCy model to select possible aspect span candidates.
- Use a SetFit model to filter these possible aspect span candidates.
- Use this SetFit model to classify the filtered aspect span candidates.
Model Details
Model Description
- Model Type: SetFit
- Sentence Transformer body: cointegrated/rubert-tiny2
- Classification head: a LogisticRegression instance
- spaCy Model: en_core_web_lg
- SetFitABSA Aspect Model: isolation-forest/setfit-absa-aspect
- SetFitABSA Polarity Model: isolation-forest/setfit-absa-polarity
- Maximum Sequence Length: 2048 tokens
- Number of Classes: 3 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 |
---|---|
Positive |
|
Neutral |
|
Negative |
|
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 AbsaModel
# Download from the 🤗 Hub
model = AbsaModel.from_pretrained(
"isolation-forest/setfit-absa-aspect",
"isolation-forest/setfit-absa-polarity",
)
# Run inference
preds = model("The food was great, but the venue is just way too busy.")
Training Details
Training Set Metrics
Training set | Min | Median | Max |
---|---|---|---|
Word count | 5 | 27.2578 | 171 |
Label | Training Sample Count |
---|---|
Negative | 54 |
Neutral | 19 |
Positive | 183 |
Training Hyperparameters
- batch_size: (16, 2)
- num_epochs: (1, 16)
- 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: False
Training Results
Epoch | Step | Training Loss | Validation Loss |
---|---|---|---|
0.0004 | 1 | 0.2493 | - |
0.0216 | 50 | 0.2343 | - |
0.0432 | 100 | 0.2786 | - |
0.0648 | 150 | 0.1976 | - |
0.0864 | 200 | 0.2 | - |
0.1080 | 250 | 0.1894 | - |
0.1296 | 300 | 0.081 | - |
0.1513 | 350 | 0.1189 | - |
0.1729 | 400 | 0.0279 | - |
0.1945 | 450 | 0.0755 | - |
0.2161 | 500 | 0.0436 | - |
0.2377 | 550 | 0.0231 | - |
0.2593 | 600 | 0.0088 | - |
0.2809 | 650 | 0.0686 | - |
0.3025 | 700 | 0.0138 | - |
0.3241 | 750 | 0.0137 | - |
0.3457 | 800 | 0.0087 | - |
0.3673 | 850 | 0.0131 | - |
0.3889 | 900 | 0.0245 | - |
0.4105 | 950 | 0.0093 | - |
0.4322 | 1000 | 0.0036 | - |
0.4538 | 1050 | 0.0149 | - |
0.4754 | 1100 | 0.02 | - |
0.4970 | 1150 | 0.0387 | - |
0.5186 | 1200 | 0.017 | - |
0.5402 | 1250 | 0.0417 | - |
0.5618 | 1300 | 0.0041 | - |
0.5834 | 1350 | 0.0041 | - |
0.6050 | 1400 | 0.0282 | - |
0.6266 | 1450 | 0.0102 | - |
0.6482 | 1500 | 0.0037 | - |
0.6698 | 1550 | 0.0058 | - |
0.6914 | 1600 | 0.0078 | - |
0.7131 | 1650 | 0.0272 | - |
0.7347 | 1700 | 0.0224 | - |
0.7563 | 1750 | 0.0057 | - |
0.7779 | 1800 | 0.0026 | - |
0.7995 | 1850 | 0.0088 | - |
0.8211 | 1900 | 0.0044 | - |
0.8427 | 1950 | 0.005 | - |
0.8643 | 2000 | 0.0026 | - |
0.8859 | 2050 | 0.0072 | - |
0.9075 | 2100 | 0.0033 | - |
0.9291 | 2150 | 0.0047 | - |
0.9507 | 2200 | 0.0048 | - |
0.9723 | 2250 | 0.0042 | - |
0.9939 | 2300 | 0.0043 | - |
Framework Versions
- Python: 3.10.13
- SetFit: 1.0.3
- Sentence Transformers: 2.6.1
- spaCy: 3.7.2
- Transformers: 4.39.3
- PyTorch: 2.1.2
- Datasets: 2.18.0
- Tokenizers: 0.15.2
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}
}