SetFit Aspect Model
This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). A LogisticRegression instance is used for classification. In particular, this model is in charge of filtering aspect span candidates.
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 this SetFit model to filter these possible aspect span candidates.
- Use a SetFit model to classify the filtered aspect span candidates.
Model Details
Model Description
- Model Type: SetFit
- Classification head: a LogisticRegression instance
- spaCy Model: id_core_news_trf
- SetFitABSA Aspect Model: jetri20/ABSA_review_game_geometry-aspect
- SetFitABSA Polarity Model: jetri20/ABSA_review_game_geometry-polarity
- Maximum Sequence Length: 512 tokens
- Number of Classes: 2 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 |
---|---|
aspect |
|
no aspect |
|
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(
"jetri20/ABSA_review_game_geometry-aspect",
"jetri20/ABSA_review_game_geometry-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 | 2 | 23.5963 | 67 |
Label | Training Sample Count |
---|---|
no aspect | 754 |
aspect | 321 |
Training Hyperparameters
- batch_size: (4, 4)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 5
- 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.3713 | - |
0.0186 | 50 | 0.2045 | - |
0.0372 | 100 | 0.1548 | - |
0.0558 | 150 | 0.3116 | - |
0.0744 | 200 | 0.2066 | - |
0.0930 | 250 | 0.2932 | - |
0.1116 | 300 | 0.3138 | - |
0.1302 | 350 | 0.1258 | - |
0.1488 | 400 | 0.3442 | - |
0.1674 | 450 | 0.0558 | - |
0.1860 | 500 | 0.2819 | - |
0.2046 | 550 | 0.2211 | - |
0.2232 | 600 | 0.1269 | - |
0.2418 | 650 | 0.0098 | - |
0.2604 | 700 | 0.2395 | - |
0.2790 | 750 | 0.4382 | - |
0.2976 | 800 | 0.488 | - |
0.3162 | 850 | 0.6662 | - |
0.3348 | 900 | 0.1811 | - |
0.3534 | 950 | 0.2431 | - |
0.3720 | 1000 | 0.2032 | - |
0.3906 | 1050 | 0.0475 | - |
0.4092 | 1100 | 0.177 | - |
0.4278 | 1150 | 0.0556 | - |
0.4464 | 1200 | 0.3048 | - |
0.4650 | 1250 | 0.0015 | - |
0.4836 | 1300 | 0.0841 | - |
0.5022 | 1350 | 0.0105 | - |
0.5208 | 1400 | 0.0036 | - |
0.5394 | 1450 | 0.2296 | - |
0.5580 | 1500 | 0.0045 | - |
0.5766 | 1550 | 0.0134 | - |
0.5952 | 1600 | 0.0367 | - |
0.6138 | 1650 | 0.0044 | - |
0.6324 | 1700 | 0.0068 | - |
0.6510 | 1750 | 0.1408 | - |
0.6696 | 1800 | 0.0092 | - |
0.6882 | 1850 | 0.1926 | - |
0.7068 | 1900 | 0.0014 | - |
0.7254 | 1950 | 0.0003 | - |
0.7440 | 2000 | 0.2094 | - |
0.7626 | 2050 | 0.0329 | - |
0.7812 | 2100 | 0.0028 | - |
0.7999 | 2150 | 0.0144 | - |
0.8185 | 2200 | 0.1555 | - |
0.8371 | 2250 | 0.0005 | - |
0.8557 | 2300 | 0.0067 | - |
0.8743 | 2350 | 0.1485 | - |
0.8929 | 2400 | 0.0034 | - |
0.9115 | 2450 | 0.0044 | - |
0.9301 | 2500 | 0.2752 | - |
0.9487 | 2550 | 0.1342 | - |
0.9673 | 2600 | 0.0108 | - |
0.9859 | 2650 | 0.0106 | - |
1.0 | 2688 | - | 0.2236 |
Framework Versions
- Python: 3.10.13
- SetFit: 1.0.3
- Sentence Transformers: 3.0.1
- spaCy: 3.7.5
- Transformers: 4.36.2
- PyTorch: 2.1.2
- Datasets: 2.19.2
- 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}
}
- Downloads last month
- 8
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
HF Inference API has been turned off for this model.