Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use fefofico/nuclear_trained_harrier_end-end-true with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("fefofico/nuclear_trained_harrier_end-end-true")
preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"])
print(preds)How to use fefofico/nuclear_trained_harrier_end-end-true with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("fefofico/nuclear_trained_harrier_end-end-true")
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 microsoft/harrier-oss-v1-0.6b 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 |
|---|---|
| negative |
|
| positive |
|
| Label | F1_Macro | F1_Binary |
|---|---|---|
| all | 0.9027 | 0.9021 |
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("fefofico/nuclear_trained_harrier_end-end-true")
# Run inference
preds = model("Meanwhile, Israel has repeatedly said it will not allow Iran to develop a nuclear weapon.")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 5 | 23.5620 | 45 |
| Label | Training Sample Count |
|---|---|
| negative | 57 |
| positive | 64 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0033 | 1 | 0.2442 | - |
| 0.0660 | 20 | 0.2417 | - |
| 0.1320 | 40 | 0.2423 | - |
| 0.1980 | 60 | 0.2245 | - |
| 0.2640 | 80 | 0.2055 | - |
| 0.3300 | 100 | 0.1319 | - |
| 0.3960 | 120 | 0.0541 | - |
| 0.4620 | 140 | 0.0222 | - |
| 0.5281 | 160 | 0.0079 | - |
| 0.5941 | 180 | 0.0056 | - |
| 0.6601 | 200 | 0.0051 | - |
| 0.7261 | 220 | 0.0052 | - |
| 0.7921 | 240 | 0.0044 | - |
| 0.8581 | 260 | 0.0038 | - |
| 0.9241 | 280 | 0.0045 | - |
| 0.9901 | 300 | 0.0038 | - |
| 1.0 | 303 | - | 0.1244 |
@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
microsoft/harrier-oss-v1-0.6b