CoolFace
Modelpublic

tomaarsen/setfit-absa-bge-small-en-v1.5-restaurants-aspect

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
4likes4.8kdownloads
Model Card

SetFit Aspect Model with BAAI/bge-small-en-v1.5 on SemEval 2014 Task 4 (Restaurants)

This is a SetFit model trained on the SemEval 2014 Task 4 (Restaurants) dataset that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses BAAI/bge-small-en-v1.5 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>'staff:But the staff was so horrible to us.'</li><li>"food:To be completely fair, the only redeeming factor was the food, which was above average, but couldn't make up for all the other deficiencies of Teodora."</li><li>"food:The food is uniformly exceptional, with a very capable kitchen which will proudly whip up whatever you feel like eating, whether it's on the menu or not."</li></ul>
no aspect<ul><li>"factor:To be completely fair, the only redeeming factor was the food, which was above average, but couldn't make up for all the other deficiencies of Teodora."</li><li>"deficiencies:To be completely fair, the only redeeming factor was the food, which was above average, but couldn't make up for all the other deficiencies of Teodora."</li><li>"Teodora:To be completely fair, the only redeeming factor was the food, which was above average, but couldn't make up for all the other deficiencies of Teodora."</li></ul>

Evaluation

Metrics

LabelAccuracy
all0.8623

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(
    "tomaarsen/setfit-absa-bge-small-en-v1.5-restaurants-aspect",
    "tomaarsen/setfit-absa-bge-small-en-v1.5-restaurants-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 count419.357645
LabelTraining Sample Count
no aspect170
aspect255

Training Hyperparameters

  • —batch_size: (256, 256)
  • —num_epochs: (5, 5)
  • —max_steps: 5000
  • —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
  • —seed: 42
  • —evalmaxsteps: -1
  • —loadbestmodelatend: True

Training Results

EpochStepTraining LossValidation Loss
0.002710.2498-
0.1355500.2442-
0.27101000.24620.2496
0.40651500.2282-
0.54202000.07520.1686
0.67752500.0124-
0.81303000.01280.1884
0.94853500.0062-
1.08404000.00120.183
1.21954500.0009-
1.35505000.00080.2072
1.49055500.0031-
1.62606000.00060.1716
1.76156500.0005-
1.89707000.00050.1666
2.03257500.0005-
2.16808000.00040.2086
2.30358500.0005-
2.43909000.00040.183
2.57459500.0004-
2.710010000.00360.1725
2.845510500.0004-
2.981011000.00030.1816
3.116511500.0004-
3.252012000.00030.1802
  • —The bold row denotes the saved checkpoint.

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • —Carbon Emitted: 0.018 kg of CO2
  • —Hours Used: 0.303 hours

Training Hardware

  • —On Cloud: No
  • —GPU Model: 1 x NVIDIA GeForce RTX 3090
  • —CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
  • —RAM Size: 31.78 GB

Framework Versions

  • —Python: 3.9.16
  • —SetFit: 1.0.0.dev0
  • —Sentence Transformers: 2.2.2
  • —spaCy: 3.7.2
  • —Transformers: 4.29.0
  • —PyTorch: 1.13.1+cu117
  • —Datasets: 2.15.0
  • —Tokenizers: 0.13.3

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. -->