CoolFace
Modelpublic

najwaa/absa-combined-p2-aspect

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes4downloads
Model Card

SetFit Aspect Model with sentence-transformers/all-MiniLM-L6-v2

This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses sentence-transformers/all-MiniLM-L6-v2 as the Sentence Transformer embedding model. 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:

  1. 1.Fine-tuning a Sentence Transformer with contrastive learning.
  2. 2.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:

  1. 1.Use a spaCy model to select possible aspect span candidates.
  2. 2.Use this SetFit model to filter these possible aspect span candidates.
  3. 3.Use a SetFit model to classify the filtered aspect span candidates.

Model Details

Model Description

Model Sources

Model Labels

LabelExamples
aspect<ul><li>'light weight:this computer is so light weight and easy to carry.'</li><li>'carry:this computer is so light weight and easy to carry.'</li><li>'lightweight:very lightweight.'</li></ul>
no aspect<ul><li>'computer:this computer is so light weight and easy to carry.'</li><li>"premium:The build quality feels premium but it's surprisingly heavy for daily commuting."</li><li>"commuting:The build quality feels premium but it's surprisingly heavy for daily commuting."</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 AbsaModel

# Download from the 🤗 Hub
model = AbsaModel.from_pretrained(
    "najwaa/absa-combined-p2-aspect",
    "najwaa/absa-combined-p2-polarity",
)
# Run inference
preds = model("The food was great, but the venue is just way too busy.")

<!--

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 setMinMedianMax
Word count217.909452
LabelTraining Sample Count
no aspect524
aspect480

Training Hyperparameters

  • batch_size: (32, 32)
  • num_epochs: (5, 5)
  • max_steps: -1
  • sampling_strategy: oversampling
  • bodylearningrate: (2e-05, 1e-05)
  • headlearningrate: 0.01
  • loss: CosineSimilarityLoss
  • distancemetric: cosinedistance
  • margin: 0.25
  • endtoend: False
  • use_amp: True
  • warmup_proportion: 0.1
  • l2_weight: 0.01
  • seed: 42
  • evalmaxsteps: -1
  • loadbestmodelatend: True

Training Results

EpochStepTraining LossValidation Loss
0.000110.3707-
0.000610-0.3251
0.001320-0.3248
0.001930-0.3243
0.002540-0.3235
0.0032500.34470.3225
0.003860-0.3213
0.004470-0.3199
0.005180-0.3182
0.005790-0.3164
0.00631000.33960.3144
0.0070110-0.3122
0.0076120-0.3098
0.0082130-0.3074
0.0089140-0.3049
0.00951500.31980.3022
0.0101160-0.2991
0.0108170-0.2960
0.0114180-0.2928
0.0120190-0.2894
0.01262000.33440.2860
0.0133210-0.2826
0.0139220-0.2797
0.0145230-0.2767
0.0152240-0.2738
0.01582500.29610.2712
0.0164260-0.2696
0.0171270-0.2679
0.0177280-0.2661
0.0183290-0.2642
0.01903000.27410.2625
0.0196310-0.2609
0.0202320-0.2598
0.0209330-0.2592
0.0215340-0.2587
0.02213500.27440.2584
0.0228360-0.2582
0.0234370-0.2582
0.0240380-0.2584
0.0247390-0.2583
0.02534000.26790.2583
0.0259410-0.2584
0.0266420-0.2584

Framework Versions

  • Python: 3.11.12
  • SetFit: 1.1.2
  • Sentence Transformers: 4.1.0
  • spaCy: 3.7.5
  • Transformers: 4.51.3
  • PyTorch: 2.6.0+cu124
  • Datasets: 3.6.0
  • Tokenizers: 0.21.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. -->