fancyzhx/ag_news
Viewer • Updated • 128k • 135k • 190
How to use hsmashiana/distilled with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("hsmashiana/distilled")How to use hsmashiana/distilled with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("hsmashiana/distilled")
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 trained on the ag_news dataset that can be used for Text Classification. This SetFit model uses nreimers/albert-small-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 |
|---|---|
| 0 |
|
| 1 |
|
| 3 |
|
| 2 |
|
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("hsmashiana/distilled")
# Run inference
preds = model("President Blasts Firing Notre Dame's outgoing president criticized the decision to fire Tyrone Willingham after just three seasons, saying he was surprised the coach was not given more time to try to succeed.")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 14 | 38.204 | 143 |
| Label | Training Sample Count |
|---|---|
| 0 | 244 |
| 1 | 243 |
| 2 | 242 |
| 3 | 271 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0008 | 1 | 0.1226 | - |
| 0.04 | 50 | 0.0023 | - |
| 0.08 | 100 | 0.0001 | - |
| 0.12 | 150 | 0.0001 | - |
| 0.16 | 200 | 0.0 | - |
| 0.2 | 250 | 0.0 | - |
| 0.24 | 300 | 0.0 | - |
| 0.28 | 350 | 0.0 | - |
| 0.32 | 400 | 0.0 | - |
| 0.36 | 450 | 0.0 | - |
| 0.4 | 500 | 0.0 | - |
| 0.44 | 550 | 0.0 | - |
| 0.48 | 600 | 0.0 | - |
| 0.52 | 650 | 0.0 | - |
| 0.56 | 700 | 0.0 | - |
| 0.6 | 750 | 0.0 | - |
| 0.64 | 800 | 0.0 | - |
| 0.68 | 850 | 0.0 | - |
| 0.72 | 900 | 0.0 | - |
| 0.76 | 950 | 0.0 | - |
| 0.8 | 1000 | 0.0 | - |
| 0.84 | 1050 | 0.0 | - |
| 0.88 | 1100 | 0.0 | - |
| 0.92 | 1150 | 0.0 | - |
| 0.96 | 1200 | 0.0 | - |
| 1.0 | 1250 | 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}
}
Base model
nreimers/albert-small-v2