CoolFace
Modelpublic

firqaaa/setfit-indo-absa-restaurant-aspect

sourceHugging Faceupdated 2y agoView on Hugging Face
2likes10downloads
Model Card

SetFit Aspect Model with firqaaa/indo-sentence-bert-base

This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses firqaaa/indo-sentence-bert-base 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>'reservasi:restoran ini sangat kecil sehingga reservasi adalah suatu keharusan.'</li><li>'nyonya rumah:di sebelah kanan saya, nyo rumah berdiri di dekat seorang busboy dan mendesiskan rapido, rapido ketika dia mencoba membersihkan dan mengatur ulang meja untuk enam orang nyonya rumah'</li><li>'busboy:di sebelah kanan saya, nyo rumah berdiri di dekat seorang busboy dan mendesiskan rapido, rapido ketika dia mencoba membersihkan dan mengatur ulang meja untuk enam orang.'</li></ul>
no aspect<ul><li>'restoran:restoran ini sangat kecil sehingga reservasi adalah suatu keharusan.'</li><li>'keharusan:restoran ini sangat kecil sehingga reservasi adalah suatu keharusan.'</li><li>'sebelah kanan:di sebelah kanan saya, nyo rumah berdiri di dekat seorang busboy dan mendesiskan rapido, rapido ketika dia mencoba membersihkan dan mengatur ulang meja untuk enam orang nyonya rumah'</li></ul>

Evaluation

Metrics

LabelAccuracy
all0.9087

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(
    "firqaaa/setfit-indo-absa-restaurants-aspect",
    "firqaaa/setfit-indo-absa-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 count219.781959
LabelTraining Sample Count
no aspect2939
aspect1468

Training Hyperparameters

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

Training Results

EpochStepTraining LossValidation Loss
0.000010.3135-
0.0001500.3401-
0.00011000.3212-
0.00021500.3641-
0.00032000.3317-
0.00042500.2809-
0.00043000.2446-
0.00053500.284-
0.00064000.3257-
0.00074500.2996-
0.00075000.2090.295
0.00085500.2121-
0.00096000.2204-
0.00106500.3023-
0.00107000.3253-
0.00117500.233-
0.00128000.3131-
0.00138500.2873-
0.00139000.2028-
0.00149500.2608-
0.001510000.28420.2696
0.001610500.2297-
0.001611000.266-
0.001711500.2771-
0.001812000.2347-
0.001912500.2539-
0.001913000.3409-
0.002013500.2925-
0.002114000.2608-
0.002114500.2792-
0.002215000.2610.2636
0.002315500.2596-
0.002416000.2563-
0.002416500.2329-
0.002517000.2954-
0.002617500.3329-
0.002718000.2138-
0.002718500.2591-
0.002819000.268-
0.002919500.2144-
0.003020000.23610.2586
0.003020500.2322-
0.003121000.2646-
0.003221500.2018-
0.003322000.2579-
0.003322500.2501-
0.003423000.2657-
0.003523500.2272-
0.003624000.2383-
0.003624500.2615-
0.003725000.28180.2554
0.003825500.2616-
0.003926000.2225-
0.003926500.2749-
0.004027000.2572-
0.004127500.2729-
0.004128000.2559-
0.004228500.2363-
0.004329000.2518-
0.004429500.1948-
0.004430000.28420.2538
0.004530500.2243-
0.004631000.2186-
0.004731500.2829-
0.004732000.2101-
0.004832500.2156-
0.004933000.2539-
0.005033500.3005-
0.005034000.2699-
0.005134500.2431-
0.005235000.29310.2515
0.005335500.2032-
0.005336000.2451-
0.005436500.2419-
0.005537000.2267-
0.005637500.2945-
0.005638000.2689-
0.005738500.2596-
0.005839000.2978-
0.005939500.2876-
0.005940000.24840.2482
0.006040500.2698-
0.006141000.2155-
0.006141500.2474-
0.006242000.2683-
0.006342500.2979-
0.006443000.2866-
0.006443500.2604-
0.006544000.1989-
0.006644500.2708-
0.006745000.27050.2407
0.006745500.2144-
0.006846000.2503-
0.006946500.2193-
0.007047000.1796-
0.007047500.2384-
0.007148000.1933-
0.007248500.2248-
0.007349000.22-
0.007349500.2052-
0.007450000.23140.224
0.007550500.2279-
0.007651000.2198-
0.007651500.2332-
0.007752000.1666-
0.007852500.1949-
0.007953000.1802-
0.007953500.2496-
0.008054000.2399-
0.008154500.2042-
0.008255000.18590.2077
0.008255500.2216-
0.008356000.1227-
0.008456500.2351-
0.008457000.2735-
0.008557500.1008-
0.008658000.1568-
0.008758500.1211-
0.008759000.0903-
0.008859500.1473-
0.008960000.11670.1877
0.009060500.206-
0.009061000.2392-
0.009161500.116-
0.009262000.1493-
0.009362500.1373-
0.009363000.1163-
0.009463500.0669-
0.009564000.0756-
0.009664500.0788-
0.009665000.18160.1838
0.009765500.1288-
0.009866000.0946-
0.009966500.1374-
0.009967000.2167-
0.010067500.0759-
0.010168000.1543-
0.010268500.0573-
0.010269000.1169-
0.010369500.0294-
0.010470000.12410.1769
0.010470500.0803-
0.010571000.0139-
0.010671500.01-
0.010772000.0502-
0.010772500.0647-
0.010873000.0117-
0.010973500.0894-
0.011074000.0101-
0.011074500.0066-
0.011175000.03470.1899
0.011275500.0893-
0.011376000.0127-
0.011376500.1285-
0.011477000.0049-
0.011577500.0571-
0.011678000.0068-
0.011678500.0586-
0.011779000.0788-
0.011879500.0655-
0.011980000.00520.1807
0.011980500.0849-
0.012081000.0133-
0.012181500.0445-
0.012282000.0118-
0.012282500.0118-
0.012383000.063-
0.012483500.0751-
0.012484000.058-
0.012584500.002-
0.012685000.00580.1804
0.012785500.0675-
0.012786000.0067-
0.012886500.0087-
0.012987000.0028-
0.013087500.0626-
0.013088000.0563-
0.013188500.0012-
0.013289000.0067-
0.013389500.0011-
0.013390000.01050.189
0.013490500.101-
0.013591000.1162-
0.013691500.0593-
0.013692000.0004-
0.013792500.0012-
0.013893000.0022-
0.013993500.0033-
0.013994000.0025-
0.014094500.0578-
0.014195000.00120.1967
  • —The bold row denotes the saved checkpoint.

Framework Versions

  • —Python: 3.10.13
  • —SetFit: 1.0.3
  • —Sentence Transformers: 2.2.2
  • —spaCy: 3.7.4
  • —Transformers: 4.36.2
  • —PyTorch: 2.1.2+cu121
  • —Datasets: 2.16.1
  • —Tokenizers: 0.15.0

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