Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use alexsheiko/setfit-email-model with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("alexsheiko/setfit-email-model")How to use alexsheiko/setfit-email-model with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("alexsheiko/setfit-email-model")
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/all-MiniLM-L6-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 |
|---|---|
| 👨⚖️ Legal |
|
| 👮🏽♂️ Security |
|
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("\"The Impact of Assessment for 21 st Century Skills in Higher Education Institutions: A Narrative Literature Review\" by Rany Sam You read the paper Assessing 21st century skills: Integrating research findings. We found a related paper on Academia:\r\n\r\nThe Impact of Assessment for 21 st Century Skills in Higher Education Institutions: A Narrative Literature Review\r\nPaper Thumbnail\t\r\nAuthor Photo Rany Sam\r\n2024, Multitech Publisher\r\n23 Views \r\nView PDF \u25B8\r\n \t\t\r\nDownload PDF \u2B07\r\n\r")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 9 | 59.875 | 79 |
| Label | Training Sample Count |
|---|---|
| 👨⚖️ Legal | 6 |
| 👮🏽♂️ Security | 2 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0333 | 1 | 0.2806 | - |
| 1.6667 | 50 | 0.038 | - |
@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
nreimers/MiniLM-L6-H384-uncased