Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 6
How to use Ezzaldin-97/LaBSE-based-Arabic-News-Classifier with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("Ezzaldin-97/LaBSE-based-Arabic-News-Classifier")How to use Ezzaldin-97/LaBSE-based-Arabic-News-Classifier with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Ezzaldin-97/LaBSE-based-Arabic-News-Classifier")
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/LaBSE 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 |
|---|---|
| life |
|
| politics |
|
| sports |
|
| business |
|
| Label | Accuracy |
|---|---|
| all | 0.9083 |
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("Ezzaldin-97/LaBSE-based-Arabic-News-Classifier")
# Run inference
preds = model("نقلت صحيفة واشنطن بوست امس عن مستشار الرئيس الاميركي باراك اوباما للامن القومي قوله ان اوباما يعتزم توسيع عضوية مجلس الامن القومي وزيادة سلطته لوضع استراتيجية سلسلة واسعة من القضايا الداخلية والدولية.")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 11 | 32.9082 | 60 |
| Label | Training Sample Count |
|---|---|
| business | 54 |
| life | 98 |
| politics | 91 |
| sports | 73 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0013 | 1 | 0.2934 | - |
| 0.0633 | 50 | 0.2025 | - |
| 0.1266 | 100 | 0.104 | - |
| 0.1899 | 150 | 0.0906 | - |
| 0.2532 | 200 | 0.0012 | - |
| 0.3165 | 250 | 0.001 | - |
| 0.3797 | 300 | 0.0008 | - |
| 0.4430 | 350 | 0.0007 | - |
| 0.5063 | 400 | 0.0005 | - |
| 0.5696 | 450 | 0.0006 | - |
| 0.6329 | 500 | 0.0003 | - |
| 0.6962 | 550 | 0.0003 | - |
| 0.7595 | 600 | 0.0004 | - |
| 0.8228 | 650 | 0.0004 | - |
| 0.8861 | 700 | 0.0003 | - |
| 0.9494 | 750 | 0.0003 | - |
| 1.0127 | 800 | 0.0003 | - |
| 1.0759 | 850 | 0.0002 | - |
| 1.1392 | 900 | 0.0002 | - |
| 1.2025 | 950 | 0.0003 | - |
| 1.2658 | 1000 | 0.0003 | - |
| 1.3291 | 1050 | 0.0002 | - |
| 1.3924 | 1100 | 0.0002 | - |
| 1.4557 | 1150 | 0.0004 | - |
| 1.5190 | 1200 | 0.0002 | - |
| 1.5823 | 1250 | 0.0003 | - |
| 1.6456 | 1300 | 0.0002 | - |
| 1.7089 | 1350 | 0.0002 | - |
| 1.7722 | 1400 | 0.0003 | - |
| 1.8354 | 1450 | 0.0002 | - |
| 1.8987 | 1500 | 0.0002 | - |
| 1.9620 | 1550 | 0.0003 | - |
@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/LaBSE