Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use peter2000/setfit-vulnerability-groups with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("peter2000/setfit-vulnerability-groups")How to use peter2000/setfit-vulnerability-groups with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("peter2000/setfit-vulnerability-groups")
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/paraphrase-mpnet-base-v2 as the Sentence Transformer embedding model. A OneVsRestClassifier instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
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("peter2000/setfit-vulnerability-groups")
# Run inference
preds = model("The infrastructure requirement for collection based on the targets and projections made is presented in Table 12.22. A total of about 149,000 km length and 8,660km length of sewers are required for urban and rural communities, respectively by 2047. In addition, a little over 4 million facilities in urban areas and about 853,000 facilities in rural areas will be required to meet on-site sanitation needs by 2033 nationwide.")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 15 | 71.2316 | 164 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0011 | 1 | 0.3006 | - |
| 0.0526 | 50 | 0.2232 | - |
| 0.1053 | 100 | 0.1670 | - |
| 0.1579 | 150 | 0.1202 | - |
| 0.2105 | 200 | 0.0935 | - |
| 0.2632 | 250 | 0.0862 | - |
| 0.3158 | 300 | 0.0626 | - |
| 0.3684 | 350 | 0.0664 | - |
| 0.4211 | 400 | 0.0555 | - |
| 0.4737 | 450 | 0.0528 | - |
| 0.5263 | 500 | 0.0543 | - |
| 0.5789 | 550 | 0.0501 | - |
| 0.6316 | 600 | 0.0535 | - |
| 0.6842 | 650 | 0.0465 | - |
| 0.7368 | 700 | 0.0468 | - |
| 0.7895 | 750 | 0.0470 | - |
| 0.8421 | 800 | 0.0421 | - |
| 0.8947 | 850 | 0.0379 | - |
| 0.9474 | 900 | 0.0475 | - |
| 1.0 | 950 | 0.0449 | - |
@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}
}