--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: 국내산 햇잣 홍천 잣고개 잣 1kg (백잣 황잣 파지잣) 백잣(정품) 1kg (#M)식품>농산물>견과류>잣 T200 > Naverstore > 식품 > 견과류/건과류 > 견과류 > 잣 - text: 청도 감말랭이 곶감 홍시 말랭이 말린 감 프리미엄 청도 감말랭이 100g (#M)식품>농산물>건과류>감말랭이 T200 > Naverstore > 식품 > 견과류/건과류 > 건과류 > 감말랭이 - text: HYGGE(휘게) 담금주 키트 3구 선물세트(500ml x 3) 그린라이트(야관문주)_달빛 한 스푼(진저레몬주)_베리온더클라우드(딸기주) (#M)식품>농산물>건과류>기타건과류 T200 > Naverstore > 식품 > 견과류/건과류 > 건과류 > 기타건과류 - text: 올가 피스타치오(유기농) (100g) (#M)식품>농산물>견과류>피스타치오 T200 > Naverstore > 식품 > 견과류/건과류 > 견과류 > 피스타치오 - text: 원더풀피스타치오 노 쉘 칠리 로스티드 맛 2통 63g (#M)식품>농산물>견과류>피스타치오 T200 > Naverstore > 식품 > 견과류/건과류 > 견과류 > 피스타치오 metrics: - accuracy pipeline_tag: text-classification library_name: setfit inference: true base_model: klue/roberta-base model-index: - name: SetFit with klue/roberta-base results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.9994875924163678 name: Accuracy --- # SetFit with klue/roberta-base This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [klue/roberta-base](https://huggingface.co/klue/roberta-base) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification. The model has been trained using an efficient few-shot learning technique that involves: 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning. 2. Training a classification head with features from the fine-tuned Sentence Transformer. ## Model Details ### Model Description - **Model Type:** SetFit - **Sentence Transformer body:** [klue/roberta-base](https://huggingface.co/klue/roberta-base) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 512 tokens - **Number of Classes:** 22 classes ### Model Sources - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit) - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055) - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) ### Model Labels | Label | Examples | |:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 7.0 | | | 10.0 | | | 11.0 | | | 1.0 | | | 5.0 | | | 17.0 | | | 21.0 | | | 2.0 | | | 3.0 | | | 6.0 | | | 20.0 | | | 15.0 | | | 4.0 | | | 0.0 | | | 12.0 | | | 19.0 | | | 18.0 | | | 8.0 | | | 16.0 | | | 14.0 | | | 13.0 | | | 9.0 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.9995 | ## Uses ### Direct Use for Inference First install the SetFit library: ```bash pip install setfit ``` Then you can load this model and run inference. ```python from setfit import SetFitModel # Download from the 🤗 Hub model = SetFitModel.from_pretrained("mini1013/master_cate_top_fd3") # Run inference preds = model("올가 피스타치오(유기농) (100g) (#M)식품>농산물>견과류>피스타치오 T200 > Naverstore > 식품 > 견과류/건과류 > 견과류 > 피스타치오") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 14 | 21.3455 | 44 | | Label | Training Sample Count | |:------|:----------------------| | 0.0 | 50 | | 1.0 | 50 | | 2.0 | 50 | | 3.0 | 50 | | 4.0 | 50 | | 5.0 | 50 | | 6.0 | 50 | | 7.0 | 50 | | 8.0 | 50 | | 9.0 | 50 | | 10.0 | 50 | | 11.0 | 50 | | 12.0 | 50 | | 13.0 | 50 | | 14.0 | 50 | | 15.0 | 50 | | 16.0 | 50 | | 17.0 | 50 | | 18.0 | 50 | | 19.0 | 50 | | 20.0 | 50 | | 21.0 | 50 | ### Training Hyperparameters - batch_size: (64, 64) - num_epochs: (20, 20) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 30 - body_learning_rate: (2e-05, 1e-05) - head_learning_rate: 0.01 - loss: CosineSimilarityLoss - distance_metric: cosine_distance - margin: 0.25 - end_to_end: False - use_amp: False - warmup_proportion: 0.1 - l2_weight: 0.01 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:-------:|:-----:|:-------------:|:---------------:| | 0.0019 | 1 | 0.5252 | - | | 0.0969 | 50 | 0.4976 | - | | 0.1938 | 100 | 0.4278 | - | | 0.2907 | 150 | 0.284 | - | | 0.3876 | 200 | 0.1919 | - | | 0.4845 | 250 | 0.0728 | - | | 0.5814 | 300 | 0.0359 | - | | 0.6783 | 350 | 0.0246 | - | | 0.7752 | 400 | 0.0175 | - | | 0.8721 | 450 | 0.014 | - | | 0.9690 | 500 | 0.0099 | - | | 1.0659 | 550 | 0.0103 | - | | 1.1628 | 600 | 0.0108 | - | | 1.2597 | 650 | 0.0094 | - | | 1.3566 | 700 | 0.0107 | - | | 1.4535 | 750 | 0.0078 | - | | 1.5504 | 800 | 0.0027 | - | | 1.6473 | 850 | 0.0019 | - | | 1.7442 | 900 | 0.0014 | - | | 1.8411 | 950 | 0.0029 | - | | 1.9380 | 1000 | 0.0023 | - | | 2.0349 | 1050 | 0.0012 | - | | 2.1318 | 1100 | 0.0017 | - | | 2.2287 | 1150 | 0.0021 | - | | 2.3256 | 1200 | 0.0014 | - | | 2.4225 | 1250 | 0.0003 | - | | 2.5194 | 1300 | 0.0001 | - | | 2.6163 | 1350 | 0.0001 | - | | 2.7132 | 1400 | 0.0001 | - | | 2.8101 | 1450 | 0.0001 | - | | 2.9070 | 1500 | 0.0001 | - | | 3.0039 | 1550 | 0.0001 | - | | 3.1008 | 1600 | 0.0001 | - | | 3.1977 | 1650 | 0.0001 | - | | 3.2946 | 1700 | 0.0001 | - | | 3.3915 | 1750 | 0.0001 | - | | 3.4884 | 1800 | 0.0001 | - | | 3.5853 | 1850 | 0.0 | - | | 3.6822 | 1900 | 0.0 | - | | 3.7791 | 1950 | 0.0 | - | | 3.8760 | 2000 | 0.0 | - | | 3.9729 | 2050 | 0.0 | - | | 4.0698 | 2100 | 0.0 | - | | 4.1667 | 2150 | 0.0 | - | | 4.2636 | 2200 | 0.0 | - | | 4.3605 | 2250 | 0.0 | - | | 4.4574 | 2300 | 0.0001 | - | | 4.5543 | 2350 | 0.0 | - | | 4.6512 | 2400 | 0.0 | - | | 4.7481 | 2450 | 0.0 | - | | 4.8450 | 2500 | 0.0 | - | | 4.9419 | 2550 | 0.0 | - | | 5.0388 | 2600 | 0.0 | - | | 5.1357 | 2650 | 0.0 | - | | 5.2326 | 2700 | 0.0 | - | | 5.3295 | 2750 | 0.0 | - | | 5.4264 | 2800 | 0.0 | - | | 5.5233 | 2850 | 0.0 | - | | 5.6202 | 2900 | 0.0 | - | | 5.7171 | 2950 | 0.0 | - | | 5.8140 | 3000 | 0.0 | - | | 5.9109 | 3050 | 0.0 | - | | 6.0078 | 3100 | 0.0 | - | | 6.1047 | 3150 | 0.0 | - | | 6.2016 | 3200 | 0.0 | - | | 6.2984 | 3250 | 0.0 | - | | 6.3953 | 3300 | 0.0 | - | | 6.4922 | 3350 | 0.0 | - | | 6.5891 | 3400 | 0.0 | - | | 6.6860 | 3450 | 0.0 | - | | 6.7829 | 3500 | 0.0 | - | | 6.8798 | 3550 | 0.0 | - | | 6.9767 | 3600 | 0.0 | - | | 7.0736 | 3650 | 0.0 | - | | 7.1705 | 3700 | 0.0 | - | | 7.2674 | 3750 | 0.0 | - | | 7.3643 | 3800 | 0.0 | - | | 7.4612 | 3850 | 0.0 | - | | 7.5581 | 3900 | 0.0 | - | | 7.6550 | 3950 | 0.0 | - | | 7.7519 | 4000 | 0.0 | - | | 7.8488 | 4050 | 0.0 | - | | 7.9457 | 4100 | 0.0 | - | | 8.0426 | 4150 | 0.0 | - | | 8.1395 | 4200 | 0.0 | - | | 8.2364 | 4250 | 0.0 | - | | 8.3333 | 4300 | 0.0 | - | | 8.4302 | 4350 | 0.0 | - | | 8.5271 | 4400 | 0.0 | - | | 8.6240 | 4450 | 0.0 | - | | 8.7209 | 4500 | 0.0 | - | | 8.8178 | 4550 | 0.0 | - | | 8.9147 | 4600 | 0.0 | - | | 9.0116 | 4650 | 0.0 | - | | 9.1085 | 4700 | 0.0 | - | | 9.2054 | 4750 | 0.0 | - | | 9.3023 | 4800 | 0.0 | - | | 9.3992 | 4850 | 0.0 | - | | 9.4961 | 4900 | 0.0 | - | | 9.5930 | 4950 | 0.0 | - | | 9.6899 | 5000 | 0.0 | - | | 9.7868 | 5050 | 0.0 | - | | 9.8837 | 5100 | 0.0 | - | | 9.9806 | 5150 | 0.0 | - | | 10.0775 | 5200 | 0.0 | - | | 10.1744 | 5250 | 0.0 | - | | 10.2713 | 5300 | 0.0 | - | | 10.3682 | 5350 | 0.0 | - | | 10.4651 | 5400 | 0.0 | - | | 10.5620 | 5450 | 0.0 | - | | 10.6589 | 5500 | 0.0 | - | | 10.7558 | 5550 | 0.0 | - | | 10.8527 | 5600 | 0.0 | - | | 10.9496 | 5650 | 0.0 | - | | 11.0465 | 5700 | 0.0 | - | | 11.1434 | 5750 | 0.0 | - | | 11.2403 | 5800 | 0.0 | - | | 11.3372 | 5850 | 0.0 | - | | 11.4341 | 5900 | 0.0 | - | | 11.5310 | 5950 | 0.0 | - | | 11.6279 | 6000 | 0.0 | - | | 11.7248 | 6050 | 0.0 | - | | 11.8217 | 6100 | 0.0 | - | | 11.9186 | 6150 | 0.0 | - | | 12.0155 | 6200 | 0.0 | - | | 12.1124 | 6250 | 0.0 | - | | 12.2093 | 6300 | 0.0 | - | | 12.3062 | 6350 | 0.0 | - | | 12.4031 | 6400 | 0.0 | - | | 12.5 | 6450 | 0.0 | - | | 12.5969 | 6500 | 0.0 | - | | 12.6938 | 6550 | 0.0 | - | | 12.7907 | 6600 | 0.0 | - | | 12.8876 | 6650 | 0.0 | - | | 12.9845 | 6700 | 0.0 | - | | 13.0814 | 6750 | 0.0 | - | | 13.1783 | 6800 | 0.0 | - | | 13.2752 | 6850 | 0.0 | - | | 13.3721 | 6900 | 0.0 | - | | 13.4690 | 6950 | 0.0 | - | | 13.5659 | 7000 | 0.0 | - | | 13.6628 | 7050 | 0.0 | - | | 13.7597 | 7100 | 0.0 | - | | 13.8566 | 7150 | 0.0 | - | | 13.9535 | 7200 | 0.0 | - | | 14.0504 | 7250 | 0.0 | - | | 14.1473 | 7300 | 0.0 | - | | 14.2442 | 7350 | 0.0 | - | | 14.3411 | 7400 | 0.0 | - | | 14.4380 | 7450 | 0.0 | - | | 14.5349 | 7500 | 0.0 | - | | 14.6318 | 7550 | 0.0 | - | | 14.7287 | 7600 | 0.0 | - | | 14.8256 | 7650 | 0.0 | - | | 14.9225 | 7700 | 0.0 | - | | 15.0194 | 7750 | 0.0 | - | | 15.1163 | 7800 | 0.0 | - | | 15.2132 | 7850 | 0.0 | - | | 15.3101 | 7900 | 0.0 | - | | 15.4070 | 7950 | 0.0 | - | | 15.5039 | 8000 | 0.0 | - | | 15.6008 | 8050 | 0.0 | - | | 15.6977 | 8100 | 0.0 | - | | 15.7946 | 8150 | 0.0 | - | | 15.8915 | 8200 | 0.0 | - | | 15.9884 | 8250 | 0.0 | - | | 16.0853 | 8300 | 0.0 | - | | 16.1822 | 8350 | 0.0 | - | | 16.2791 | 8400 | 0.0 | - | | 16.3760 | 8450 | 0.0 | - | | 16.4729 | 8500 | 0.0 | - | | 16.5698 | 8550 | 0.0 | - | | 16.6667 | 8600 | 0.0 | - | | 16.7636 | 8650 | 0.0 | - | | 16.8605 | 8700 | 0.0 | - | | 16.9574 | 8750 | 0.0 | - | | 17.0543 | 8800 | 0.0 | - | | 17.1512 | 8850 | 0.0 | - | | 17.2481 | 8900 | 0.0 | - | | 17.3450 | 8950 | 0.0 | - | | 17.4419 | 9000 | 0.0 | - | | 17.5388 | 9050 | 0.0 | - | | 17.6357 | 9100 | 0.0 | - | | 17.7326 | 9150 | 0.0 | - | | 17.8295 | 9200 | 0.0 | - | | 17.9264 | 9250 | 0.0 | - | | 18.0233 | 9300 | 0.0 | - | | 18.1202 | 9350 | 0.0 | - | | 18.2171 | 9400 | 0.0 | - | | 18.3140 | 9450 | 0.0 | - | | 18.4109 | 9500 | 0.0 | - | | 18.5078 | 9550 | 0.0 | - | | 18.6047 | 9600 | 0.0 | - | | 18.7016 | 9650 | 0.0 | - | | 18.7984 | 9700 | 0.0 | - | | 18.8953 | 9750 | 0.0 | - | | 18.9922 | 9800 | 0.0 | - | | 19.0891 | 9850 | 0.0 | - | | 19.1860 | 9900 | 0.0 | - | | 19.2829 | 9950 | 0.0 | - | | 19.3798 | 10000 | 0.0 | - | | 19.4767 | 10050 | 0.0 | - | | 19.5736 | 10100 | 0.0 | - | | 19.6705 | 10150 | 0.0 | - | | 19.7674 | 10200 | 0.0 | - | | 19.8643 | 10250 | 0.0 | - | | 19.9612 | 10300 | 0.0 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.1.0 - Sentence Transformers: 3.3.1 - Transformers: 4.44.2 - PyTorch: 2.2.0a0+81ea7a4 - Datasets: 3.2.0 - Tokenizers: 0.19.1 ## Citation ### BibTeX ```bibtex @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} } ```