Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use oyvindbs/setfit-nb-sbert-v2-large-norec-sentiment-binary with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("oyvindbs/setfit-nb-sbert-v2-large-norec-sentiment-binary")How to use oyvindbs/setfit-nb-sbert-v2-large-norec-sentiment-binary with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("oyvindbs/setfit-nb-sbert-v2-large-norec-sentiment-binary")
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 NbAiLab/nb-sbert-v2-large 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 |
|---|---|
| 1 |
|
| 0 |
|
| Label | Accuracy |
|---|---|
| all | 0.8919 |
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("Filmen er til tider nesten hypnotisk vakker .")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 1 | 19.035 | 68 |
| Label | Training Sample Count |
|---|---|
| 0 | 72 |
| 1 | 128 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0014 | 1 | 0.2952 | - |
| 0.0689 | 50 | 0.2914 | - |
| 0.1377 | 100 | 0.1583 | - |
| 0.2066 | 150 | 0.0103 | - |
| 0.2755 | 200 | 0.0012 | - |
| 0.3444 | 250 | 0.0005 | - |
| 0.4132 | 300 | 0.0003 | - |
| 0.4821 | 350 | 0.0003 | - |
| 0.5510 | 400 | 0.0002 | - |
| 0.6198 | 450 | 0.0001 | - |
| 0.6887 | 500 | 0.0001 | - |
| 0.7576 | 550 | 0.0001 | - |
| 0.8264 | 600 | 0.0001 | - |
| 0.8953 | 650 | 0.0001 | - |
| 0.9642 | 700 | 0.0001 | - |
| 1.0331 | 750 | 0.0001 | - |
| 1.1019 | 800 | 0.0001 | - |
| 1.1708 | 850 | 0.0001 | - |
| 1.2397 | 900 | 0.0001 | - |
| 1.3085 | 950 | 0.0001 | - |
| 1.3774 | 1000 | 0.0001 | - |
| 1.4463 | 1050 | 0.0001 | - |
| 1.5152 | 1100 | 0.0001 | - |
| 1.5840 | 1150 | 0.0001 | - |
| 1.6529 | 1200 | 0.0001 | - |
| 1.7218 | 1250 | 0.0001 | - |
| 1.7906 | 1300 | 0.0001 | - |
| 1.8595 | 1350 | 0.0001 | - |
| 1.9284 | 1400 | 0.0 | - |
| 1.9972 | 1450 | 0.0 | - |
| 2.0661 | 1500 | 0.0 | - |
| 2.1350 | 1550 | 0.0 | - |
| 2.2039 | 1600 | 0.0 | - |
| 2.2727 | 1650 | 0.0 | - |
| 2.3416 | 1700 | 0.0 | - |
| 2.4105 | 1750 | 0.0 | - |
| 2.4793 | 1800 | 0.0 | - |
| 2.5482 | 1850 | 0.0 | - |
| 2.6171 | 1900 | 0.0 | - |
| 2.6860 | 1950 | 0.0 | - |
| 2.7548 | 2000 | 0.0 | - |
| 2.8237 | 2050 | 0.0 | - |
| 2.8926 | 2100 | 0.0 | - |
| 2.9614 | 2150 | 0.0 | - |
| 3.0303 | 2200 | 0.0 | - |
| 3.0992 | 2250 | 0.0 | - |
| 3.1680 | 2300 | 0.0 | - |
| 3.2369 | 2350 | 0.0 | - |
| 3.3058 | 2400 | 0.0 | - |
| 3.3747 | 2450 | 0.0 | - |
| 3.4435 | 2500 | 0.0 | - |
| 3.5124 | 2550 | 0.0 | - |
| 3.5813 | 2600 | 0.0 | - |
| 3.6501 | 2650 | 0.0 | - |
| 3.7190 | 2700 | 0.0 | - |
| 3.7879 | 2750 | 0.0 | - |
| 3.8567 | 2800 | 0.0 | - |
| 3.9256 | 2850 | 0.0 | - |
| 3.9945 | 2900 | 0.0 | - |
| 4.0634 | 2950 | 0.0 | - |
| 4.1322 | 3000 | 0.0 | - |
| 4.2011 | 3050 | 0.0 | - |
| 4.2700 | 3100 | 0.0 | - |
| 4.3388 | 3150 | 0.0 | - |
| 4.4077 | 3200 | 0.0 | - |
| 4.4766 | 3250 | 0.0004 | - |
| 4.5455 | 3300 | 0.0003 | - |
| 4.6143 | 3350 | 0.0 | - |
| 4.6832 | 3400 | 0.0 | - |
| 4.7521 | 3450 | 0.0 | - |
| 4.8209 | 3500 | 0.0006 | - |
| 4.8898 | 3550 | 0.0 | - |
| 4.9587 | 3600 | 0.0 | - |
@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}
}