Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 7
How to use mini1013/master_cate_el14 with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("mini1013/master_cate_el14")
preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"])
print(preds)How to use mini1013/master_cate_el14 with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("mini1013/master_cate_el14")
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 mini1013/master_domain 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 |
|---|---|
| 12 |
|
| 8 |
|
| 15 |
|
| 21 |
|
| 17 |
|
| 20 |
|
| 13 |
|
| 19 |
|
| 10 |
|
| 6 |
|
| 18 |
|
| 1 |
|
| 14 |
|
| 0 |
|
| 7 |
|
| 2 |
|
| 11 |
|
| 5 |
|
| 9 |
|
| 3 |
|
| 16 |
|
| 4 |
|
| Label | Metric |
|---|---|
| all | 0.7123 |
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("mini1013/master_cate_el14")
# Run inference
preds = model("브리츠 P510GX 유선이어폰 음악+통화 언더이어 오픈형 (주)엠글로벌스")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 3 | 9.4791 | 33 |
| Label | Training Sample Count |
|---|---|
| 0 | 50 |
| 1 | 50 |
| 2 | 50 |
| 3 | 12 |
| 4 | 4 |
| 5 | 50 |
| 6 | 50 |
| 7 | 50 |
| 8 | 50 |
| 9 | 50 |
| 10 | 50 |
| 11 | 50 |
| 12 | 50 |
| 13 | 50 |
| 14 | 50 |
| 15 | 50 |
| 16 | 50 |
| 17 | 50 |
| 18 | 50 |
| 19 | 13 |
| 20 | 50 |
| 21 | 50 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0065 | 1 | 0.497 | - |
| 0.3268 | 50 | 0.3791 | - |
| 0.6536 | 100 | 0.2221 | - |
| 0.9804 | 150 | 0.1258 | - |
| 1.3072 | 200 | 0.0648 | - |
| 1.6340 | 250 | 0.0513 | - |
| 1.9608 | 300 | 0.0383 | - |
| 2.2876 | 350 | 0.0297 | - |
| 2.6144 | 400 | 0.0308 | - |
| 2.9412 | 450 | 0.0208 | - |
| 3.2680 | 500 | 0.0132 | - |
| 3.5948 | 550 | 0.0188 | - |
| 3.9216 | 600 | 0.0196 | - |
| 4.2484 | 650 | 0.0158 | - |
| 4.5752 | 700 | 0.0061 | - |
| 4.9020 | 750 | 0.009 | - |
| 5.2288 | 800 | 0.0107 | - |
| 5.5556 | 850 | 0.0048 | - |
| 5.8824 | 900 | 0.0024 | - |
| 6.2092 | 950 | 0.0077 | - |
| 6.5359 | 1000 | 0.0023 | - |
| 6.8627 | 1050 | 0.0077 | - |
| 7.1895 | 1100 | 0.006 | - |
| 7.5163 | 1150 | 0.003 | - |
| 7.8431 | 1200 | 0.0046 | - |
| 8.1699 | 1250 | 0.0062 | - |
| 8.4967 | 1300 | 0.003 | - |
| 8.8235 | 1350 | 0.0022 | - |
| 9.1503 | 1400 | 0.0004 | - |
| 9.4771 | 1450 | 0.0003 | - |
| 9.8039 | 1500 | 0.0003 | - |
| 10.1307 | 1550 | 0.0022 | - |
| 10.4575 | 1600 | 0.0006 | - |
| 10.7843 | 1650 | 0.0002 | - |
| 11.1111 | 1700 | 0.0002 | - |
| 11.4379 | 1750 | 0.0002 | - |
| 11.7647 | 1800 | 0.0029 | - |
| 12.0915 | 1850 | 0.0002 | - |
| 12.4183 | 1900 | 0.0001 | - |
| 12.7451 | 1950 | 0.0001 | - |
| 13.0719 | 2000 | 0.0001 | - |
| 13.3987 | 2050 | 0.0001 | - |
| 13.7255 | 2100 | 0.0001 | - |
| 14.0523 | 2150 | 0.0002 | - |
| 14.3791 | 2200 | 0.0001 | - |
| 14.7059 | 2250 | 0.0001 | - |
| 15.0327 | 2300 | 0.0001 | - |
| 15.3595 | 2350 | 0.0001 | - |
| 15.6863 | 2400 | 0.0001 | - |
| 16.0131 | 2450 | 0.0002 | - |
| 16.3399 | 2500 | 0.0001 | - |
| 16.6667 | 2550 | 0.002 | - |
| 16.9935 | 2600 | 0.0001 | - |
| 17.3203 | 2650 | 0.002 | - |
| 17.6471 | 2700 | 0.0001 | - |
| 17.9739 | 2750 | 0.0001 | - |
| 18.3007 | 2800 | 0.0001 | - |
| 18.6275 | 2850 | 0.0001 | - |
| 18.9542 | 2900 | 0.0021 | - |
| 19.2810 | 2950 | 0.0001 | - |
| 19.6078 | 3000 | 0.0001 | - |
| 19.9346 | 3050 | 0.0001 | - |
@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}
}