Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use MattiaTintori/ABSA_Polarity_EN with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("MattiaTintori/ABSA_Polarity_EN")How to use MattiaTintori/ABSA_Polarity_EN with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("MattiaTintori/ABSA_Polarity_EN")
sentences = [
"The weather is lovely today.",
"It's so sunny outside!",
"He drove to the stadium."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses sentence-transformers/all-mpnet-base-v2 as the Sentence Transformer embedding model. A SetFitHead 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:
This model was trained within the context of a larger system for ABSA, which looks like so:
| Label | Examples |
|---|---|
| 1 |
|
| 2 |
|
| 0 |
|
| Label | F1 |
|---|---|
| all | 0.8170 |
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(
"setfit-absa-aspect",
"MattiaTintori/Final_polarity_Colab",
)
# Run inference
preds = model("The food was great, but the venue is just way too busy.")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 1 | 25.0463 | 79 |
| Label | Training Sample Count |
|---|---|
| 0 | 1148 |
| 1 | 607 |
| 2 | 489 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0014 | 1 | 0.3084 | - |
| 0.0285 | 20 | 0.2735 | 0.2591 |
| 0.0570 | 40 | 0.2228 | 0.2351 |
| 0.0855 | 60 | 0.2071 | 0.1993 |
| 0.1140 | 80 | 0.1522 | 0.1696 |
| 0.1425 | 100 | 0.1441 | 0.1671 |
| 0.1709 | 120 | 0.1632 | 0.161 |
| 0.1994 | 140 | 0.0966 | 0.1575 |
| 0.2279 | 160 | 0.1737 | 0.1504 |
| 0.2564 | 180 | 0.1092 | 0.1671 |
| 0.2849 | 200 | 0.1314 | 0.1459 |
| 0.3134 | 220 | 0.0972 | 0.1483 |
| 0.3419 | 240 | 0.1014 | 0.1537 |
| 0.3704 | 260 | 0.0506 | 0.1514 |
| 0.3989 | 280 | 0.0817 | 0.143 |
| 0.4274 | 300 | 0.0592 | 0.1526 |
| 0.4558 | 320 | 0.0311 | 0.1562 |
| 0.4843 | 340 | 0.038 | 0.1546 |
| 0.5128 | 360 | 0.0852 | 0.1497 |
| 0.5413 | 380 | 0.0359 | 0.144 |
| 0.5698 | 400 | 0.0449 | 0.1639 |
| 0.5983 | 420 | 0.0314 | 0.1517 |
@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}
}
Base model
sentence-transformers/all-mpnet-base-v2