Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use Methni/STEMO-SetFit with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("Methni/STEMO-SetFit")How to use Methni/STEMO-SetFit with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Methni/STEMO-SetFit")
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 Text Classification. This SetFit model uses sentence-transformers/paraphrase-multilingual-mpnet-base-v2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
| Label | Examples |
|---|---|
| Happy |
|
| Anger |
|
| Surprise |
|
| Fear |
|
| Sadness |
|
| Disgust |
|
First install the SetFit library:
pip install setfit
Then you can load this model and run inference.
from setfit import SetFitModel
# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("setfit_model_id")
# Run inference
preds = model("“යහපාලනේ” ඉහගෙන කන අප්රසන්න මුදල් ඇමතිගේ ලොතරැයි තියරිය … pic.twitter.com/x5sHjOZ5DT")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 1 | 14.9852 | 49 |
| Label | Training Sample Count |
|---|---|
| Happy | 182 |
| Anger | 160 |
| Sadness | 160 |
| Fear | 160 |
| Surprise | 191 |
| Disgust | 160 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0008 | 1 | 0.313 | - |
| 0.0395 | 50 | 0.2627 | - |
| 0.0789 | 100 | 0.2348 | - |
| 0.1184 | 150 | 0.1752 | - |
| 0.1579 | 200 | 0.1426 | - |
| 0.1973 | 250 | 0.1165 | - |
| 0.2368 | 300 | 0.0757 | - |
| 0.2762 | 350 | 0.0718 | - |
| 0.3157 | 400 | 0.0535 | - |
| 0.3552 | 450 | 0.0456 | - |
| 0.3946 | 500 | 0.0368 | - |
| 0.4341 | 550 | 0.0296 | - |
| 0.4736 | 600 | 0.0294 | - |
| 0.5130 | 650 | 0.0166 | - |
| 0.5525 | 700 | 0.0147 | - |
| 0.5919 | 750 | 0.006 | - |
| 0.6314 | 800 | 0.0049 | - |
| 0.6709 | 850 | 0.005 | - |
| 0.7103 | 900 | 0.0046 | - |
| 0.7498 | 950 | 0.0039 | - |
| 0.7893 | 1000 | 0.0038 | - |
| 0.8287 | 1050 | 0.0026 | - |
| 0.8682 | 1100 | 0.0024 | - |
| 0.9077 | 1150 | 0.0022 | - |
| 0.9471 | 1200 | 0.003 | - |
| 0.9866 | 1250 | 0.0013 | - |
| 1.0 | 1267 | - | 0.1362 |
@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}
}