--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: 천안 호두과자 답례품 핑크색_호두과자4알+호두파이_200-299개 (#M)식품>과자/베이커리>강정 T200 > Naverstore > 식품 > 과자/떡/베이커리 > 전통과자 > 강정 - text: 쌀땅콩엿 40g 30개입 땅콩 엿 (#M)식품>과자/베이커리>엿 T200 > Naverstore > 식품 > 과자/떡/베이커리 > 사탕/껌/엿 > 엿 - text: 파스퇴르진한우유모나카 24개 (#M)식품>과자/베이커리>아이스크림/빙수>아이스크림 GML > Naverstore > 식품 > 과자/떡/베이커리 > 아이스크림/빙수 - text: 아이스크림 파인트 2+1 / 총 3개 파인트_초코X2개_파인트_피넛버터크런치 (#M)HOME>과자/간식>빙과/아이스크림>샌드/튜브/기타 T200 > traverse > ssg > 가공/건강식품 > 과자/간식/시리얼/빙과 > 빙과/아이스크림 > 샌드/튜브/기타 - text: 일본 캔디 사탕 50알 아사히 민티아 콜드 스매쉬 브리즈-울트라 블랙 (#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.9807774834633085 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:** 21 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 | |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 15.0 | | | 5.0 | | | 7.0 | | | 10.0 | | | 3.0 | | | 0.0 | | | 16.0 | | | 4.0 | | | 20.0 | | | 11.0 | | | 17.0 | | | 18.0 | | | 2.0 | | | 19.0 | | | 14.0 | | | 12.0 | | | 13.0 | | | 6.0 | | | 9.0 | | | 1.0 | | | 8.0 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.9808 | ## 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_fd5") # Run inference preds = model("쌀땅콩엿 40g 30개입 땅콩 엿 (#M)식품>과자/베이커리>엿 T200 > Naverstore > 식품 > 과자/떡/베이커리 > 사탕/껌/엿 > 엿") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 11 | 22.5533 | 62 | | 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 | ### 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.0020 | 1 | 0.5412 | - | | 0.1014 | 50 | 0.4524 | - | | 0.2028 | 100 | 0.3473 | - | | 0.3043 | 150 | 0.24 | - | | 0.4057 | 200 | 0.137 | - | | 0.5071 | 250 | 0.0886 | - | | 0.6085 | 300 | 0.0508 | - | | 0.7099 | 350 | 0.0331 | - | | 0.8114 | 400 | 0.0217 | - | | 0.9128 | 450 | 0.0161 | - | | 1.0142 | 500 | 0.013 | - | | 1.1156 | 550 | 0.01 | - | | 1.2170 | 600 | 0.01 | - | | 1.3185 | 650 | 0.0058 | - | | 1.4199 | 700 | 0.0032 | - | | 1.5213 | 750 | 0.002 | - | | 1.6227 | 800 | 0.0016 | - | | 1.7241 | 850 | 0.0022 | - | | 1.8256 | 900 | 0.0021 | - | | 1.9270 | 950 | 0.0007 | - | | 2.0284 | 1000 | 0.0005 | - | | 2.1298 | 1050 | 0.0005 | - | | 2.2312 | 1100 | 0.0002 | - | | 2.3327 | 1150 | 0.0002 | - | | 2.4341 | 1200 | 0.0002 | - | | 2.5355 | 1250 | 0.0002 | - | | 2.6369 | 1300 | 0.0002 | - | | 2.7383 | 1350 | 0.0001 | - | | 2.8398 | 1400 | 0.0005 | - | | 2.9412 | 1450 | 0.0004 | - | | 3.0426 | 1500 | 0.0002 | - | | 3.1440 | 1550 | 0.0002 | - | | 3.2454 | 1600 | 0.0001 | - | | 3.3469 | 1650 | 0.0001 | - | | 3.4483 | 1700 | 0.0001 | - | | 3.5497 | 1750 | 0.0001 | - | | 3.6511 | 1800 | 0.0001 | - | | 3.7525 | 1850 | 0.0001 | - | | 3.8540 | 1900 | 0.0001 | - | | 3.9554 | 1950 | 0.0001 | - | | 4.0568 | 2000 | 0.0001 | - | | 4.1582 | 2050 | 0.0001 | - | | 4.2596 | 2100 | 0.0001 | - | | 4.3611 | 2150 | 0.0001 | - | | 4.4625 | 2200 | 0.0001 | - | | 4.5639 | 2250 | 0.0 | - | | 4.6653 | 2300 | 0.0 | - | | 4.7667 | 2350 | 0.0 | - | | 4.8682 | 2400 | 0.0001 | - | | 4.9696 | 2450 | 0.0 | - | | 5.0710 | 2500 | 0.0 | - | | 5.1724 | 2550 | 0.0 | - | | 5.2738 | 2600 | 0.0 | - | | 5.3753 | 2650 | 0.0 | - | | 5.4767 | 2700 | 0.0 | - | | 5.5781 | 2750 | 0.0 | - | | 5.6795 | 2800 | 0.0013 | - | | 5.7809 | 2850 | 0.0028 | - | | 5.8824 | 2900 | 0.0009 | - | | 5.9838 | 2950 | 0.0013 | - | | 6.0852 | 3000 | 0.0002 | - | | 6.1866 | 3050 | 0.0001 | - | | 6.2880 | 3100 | 0.0 | - | | 6.3895 | 3150 | 0.0 | - | | 6.4909 | 3200 | 0.0 | - | | 6.5923 | 3250 | 0.0 | - | | 6.6937 | 3300 | 0.0 | - | | 6.7951 | 3350 | 0.0 | - | | 6.8966 | 3400 | 0.0 | - | | 6.9980 | 3450 | 0.0 | - | | 7.0994 | 3500 | 0.0 | - | | 7.2008 | 3550 | 0.0 | - | | 7.3022 | 3600 | 0.0 | - | | 7.4037 | 3650 | 0.0 | - | | 7.5051 | 3700 | 0.0 | - | | 7.6065 | 3750 | 0.0 | - | | 7.7079 | 3800 | 0.0 | - | | 7.8093 | 3850 | 0.0 | - | | 7.9108 | 3900 | 0.0 | - | | 8.0122 | 3950 | 0.0 | - | | 8.1136 | 4000 | 0.0 | - | | 8.2150 | 4050 | 0.0 | - | | 8.3164 | 4100 | 0.0 | - | | 8.4178 | 4150 | 0.0 | - | | 8.5193 | 4200 | 0.0 | - | | 8.6207 | 4250 | 0.0 | - | | 8.7221 | 4300 | 0.0 | - | | 8.8235 | 4350 | 0.0 | - | | 8.9249 | 4400 | 0.0 | - | | 9.0264 | 4450 | 0.0 | - | | 9.1278 | 4500 | 0.0 | - | | 9.2292 | 4550 | 0.0 | - | | 9.3306 | 4600 | 0.0 | - | | 9.4320 | 4650 | 0.0 | - | | 9.5335 | 4700 | 0.0 | - | | 9.6349 | 4750 | 0.0 | - | | 9.7363 | 4800 | 0.0 | - | | 9.8377 | 4850 | 0.0 | - | | 9.9391 | 4900 | 0.0 | - | | 10.0406 | 4950 | 0.0 | - | | 10.1420 | 5000 | 0.0 | - | | 10.2434 | 5050 | 0.0 | - | | 10.3448 | 5100 | 0.0 | - | | 10.4462 | 5150 | 0.0 | - | | 10.5477 | 5200 | 0.0 | - | | 10.6491 | 5250 | 0.0 | - | | 10.7505 | 5300 | 0.0 | - | | 10.8519 | 5350 | 0.0 | - | | 10.9533 | 5400 | 0.0 | - | | 11.0548 | 5450 | 0.0 | - | | 11.1562 | 5500 | 0.0 | - | | 11.2576 | 5550 | 0.0 | - | | 11.3590 | 5600 | 0.0 | - | | 11.4604 | 5650 | 0.0 | - | | 11.5619 | 5700 | 0.0 | - | | 11.6633 | 5750 | 0.0 | - | | 11.7647 | 5800 | 0.0 | - | | 11.8661 | 5850 | 0.0 | - | | 11.9675 | 5900 | 0.0 | - | | 12.0690 | 5950 | 0.0 | - | | 12.1704 | 6000 | 0.0 | - | | 12.2718 | 6050 | 0.0 | - | | 12.3732 | 6100 | 0.0 | - | | 12.4746 | 6150 | 0.0 | - | | 12.5761 | 6200 | 0.0 | - | | 12.6775 | 6250 | 0.0005 | - | | 12.7789 | 6300 | 0.0025 | - | | 12.8803 | 6350 | 0.0023 | - | | 12.9817 | 6400 | 0.0004 | - | | 13.0832 | 6450 | 0.0 | - | | 13.1846 | 6500 | 0.0 | - | | 13.2860 | 6550 | 0.0 | - | | 13.3874 | 6600 | 0.0 | - | | 13.4888 | 6650 | 0.0 | - | | 13.5903 | 6700 | 0.0 | - | | 13.6917 | 6750 | 0.0 | - | | 13.7931 | 6800 | 0.0003 | - | | 13.8945 | 6850 | 0.0001 | - | | 13.9959 | 6900 | 0.0 | - | | 14.0974 | 6950 | 0.0 | - | | 14.1988 | 7000 | 0.0 | - | | 14.3002 | 7050 | 0.0 | - | | 14.4016 | 7100 | 0.0 | - | | 14.5030 | 7150 | 0.0 | - | | 14.6045 | 7200 | 0.0 | - | | 14.7059 | 7250 | 0.0 | - | | 14.8073 | 7300 | 0.0 | - | | 14.9087 | 7350 | 0.0 | - | | 15.0101 | 7400 | 0.0 | - | | 15.1116 | 7450 | 0.0 | - | | 15.2130 | 7500 | 0.0 | - | | 15.3144 | 7550 | 0.0 | - | | 15.4158 | 7600 | 0.0 | - | | 15.5172 | 7650 | 0.0 | - | | 15.6187 | 7700 | 0.0 | - | | 15.7201 | 7750 | 0.0 | - | | 15.8215 | 7800 | 0.0 | - | | 15.9229 | 7850 | 0.0 | - | | 16.0243 | 7900 | 0.0 | - | | 16.1258 | 7950 | 0.0 | - | | 16.2272 | 8000 | 0.0 | - | | 16.3286 | 8050 | 0.0 | - | | 16.4300 | 8100 | 0.0 | - | | 16.5314 | 8150 | 0.0 | - | | 16.6329 | 8200 | 0.0 | - | | 16.7343 | 8250 | 0.0 | - | | 16.8357 | 8300 | 0.0 | - | | 16.9371 | 8350 | 0.0 | - | | 17.0385 | 8400 | 0.0 | - | | 17.1400 | 8450 | 0.0 | - | | 17.2414 | 8500 | 0.0 | - | | 17.3428 | 8550 | 0.0 | - | | 17.4442 | 8600 | 0.0 | - | | 17.5456 | 8650 | 0.0 | - | | 17.6471 | 8700 | 0.0 | - | | 17.7485 | 8750 | 0.0 | - | | 17.8499 | 8800 | 0.0 | - | | 17.9513 | 8850 | 0.0 | - | | 18.0527 | 8900 | 0.0 | - | | 18.1542 | 8950 | 0.0 | - | | 18.2556 | 9000 | 0.0 | - | | 18.3570 | 9050 | 0.0 | - | | 18.4584 | 9100 | 0.0 | - | | 18.5598 | 9150 | 0.0 | - | | 18.6613 | 9200 | 0.0 | - | | 18.7627 | 9250 | 0.0 | - | | 18.8641 | 9300 | 0.0 | - | | 18.9655 | 9350 | 0.0 | - | | 19.0669 | 9400 | 0.0 | - | | 19.1684 | 9450 | 0.0 | - | | 19.2698 | 9500 | 0.0 | - | | 19.3712 | 9550 | 0.0 | - | | 19.4726 | 9600 | 0.0 | - | | 19.5740 | 9650 | 0.0 | - | | 19.6755 | 9700 | 0.0 | - | | 19.7769 | 9750 | 0.0 | - | | 19.8783 | 9800 | 0.0 | - | | 19.9797 | 9850 | 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} } ```