--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: Show me some texture backgrounds - text: Add more space between paragraphs - text: Position the text at the top - text: Create an Instagram story for a birthday - text: Create a photo of a mountain landscape metrics: - accuracy pipeline_tag: text-classification library_name: setfit inference: true base_model: nomic-ai/nomic-embed-text-v1.5 model-index: - name: SetFit with nomic-ai/nomic-embed-text-v1.5 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.6240179573512907 name: Accuracy --- # SetFit with nomic-ai/nomic-embed-text-v1.5 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [nomic-ai/nomic-embed-text-v1.5](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5) 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:** [nomic-ai/nomic-embed-text-v1.5](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 8192 tokens - **Number of Classes:** 63 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 | |:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 0 | | | 1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | 11 | | | 12 | | | 13 | | | 14 | | | 15 | | | 16 | | | 17 | | | 18 | | | 19 | | | 20 | | | 21 | | | 22 | | | 23 | | | 24 | | | 25 | | | 26 | | | 27 | | | 28 | | | 29 | | | 30 | | | 31 | | | 32 | | | 33 | | | 34 | | | 35 | | | 36 | | | 37 | | | 38 | | | 39 | | | 40 | | | 41 | | | 42 | | | 43 | | | 44 | | | 45 | | | 46 | | | 47 | | | 48 | | | 49 | | | 50 | | | 51 | | | 52 | | | 53 | | | 54 | | | 55 | | | 56 | | | 57 | | | 58 | | | 59 | | | 60 | | | 61 | | | 62 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.6240 | ## 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("setfit_model_id") # Run inference preds = model("Position the text at the top") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 3 | 5.2243 | 12 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 15 | | 1 | 15 | | 2 | 15 | | 3 | 15 | | 4 | 15 | | 5 | 15 | | 6 | 15 | | 7 | 15 | | 8 | 15 | | 9 | 15 | | 10 | 15 | | 11 | 15 | | 12 | 15 | | 13 | 15 | | 14 | 15 | | 15 | 15 | | 16 | 15 | | 17 | 15 | | 18 | 15 | | 19 | 15 | | 20 | 15 | | 21 | 15 | | 22 | 15 | | 23 | 15 | | 24 | 15 | | 25 | 15 | | 26 | 15 | | 27 | 15 | | 28 | 15 | | 29 | 15 | | 30 | 15 | | 31 | 15 | | 32 | 15 | | 33 | 15 | | 34 | 15 | | 35 | 15 | | 36 | 15 | | 37 | 15 | | 38 | 15 | | 39 | 15 | | 40 | 15 | | 41 | 15 | | 42 | 15 | | 43 | 15 | | 44 | 15 | | 45 | 15 | | 46 | 15 | | 47 | 15 | | 48 | 15 | | 49 | 15 | | 50 | 15 | | 51 | 15 | | 52 | 15 | | 53 | 15 | | 54 | 15 | | 55 | 15 | | 56 | 15 | | 57 | 15 | | 58 | 15 | | 59 | 15 | | 60 | 15 | | 61 | 15 | | 62 | 15 | ### Training Hyperparameters - batch_size: (64, 64) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - body_learning_rate: (2e-05, 1e-05) - head_learning_rate: 0.01 - loss: CosineSimilarityLoss - distance_metric: cosine_distance - margin: 0.25 - end_to_end: True - use_amp: False - warmup_proportion: 0.1 - l2_weight: 0.1 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:-----:|:-------------:|:---------------:| | 0.0001 | 1 | 0.1774 | - | | 0.0036 | 50 | 0.1629 | - | | 0.0073 | 100 | 0.1464 | - | | 0.0109 | 150 | 0.1147 | - | | 0.0146 | 200 | 0.0798 | - | | 0.0182 | 250 | 0.0552 | - | | 0.0218 | 300 | 0.0391 | - | | 0.0255 | 350 | 0.0271 | - | | 0.0291 | 400 | 0.0272 | - | | 0.0328 | 450 | 0.018 | - | | 0.0364 | 500 | 0.015 | - | | 0.0400 | 550 | 0.0136 | - | | 0.0437 | 600 | 0.012 | - | | 0.0473 | 650 | 0.0105 | - | | 0.0510 | 700 | 0.0094 | - | | 0.0546 | 750 | 0.0087 | - | | 0.0583 | 800 | 0.0061 | - | | 0.0619 | 850 | 0.0078 | - | | 0.0655 | 900 | 0.0068 | - | | 0.0692 | 950 | 0.0066 | - | | 0.0728 | 1000 | 0.0053 | - | | 0.0765 | 1050 | 0.0057 | - | | 0.0801 | 1100 | 0.0065 | - | | 0.0837 | 1150 | 0.0054 | - | | 0.0874 | 1200 | 0.0058 | - | | 0.0910 | 1250 | 0.006 | - | | 0.0947 | 1300 | 0.0048 | - | | 0.0983 | 1350 | 0.0038 | - | | 0.1019 | 1400 | 0.0034 | - | | 0.1056 | 1450 | 0.0037 | - | | 0.1092 | 1500 | 0.006 | - | | 0.1129 | 1550 | 0.0047 | - | | 0.1165 | 1600 | 0.0042 | - | | 0.1201 | 1650 | 0.0038 | - | | 0.1238 | 1700 | 0.0036 | - | | 0.1274 | 1750 | 0.0049 | - | | 0.1311 | 1800 | 0.0019 | - | | 0.1347 | 1850 | 0.003 | - | | 0.1384 | 1900 | 0.003 | - | | 0.1420 | 1950 | 0.0024 | - | | 0.1456 | 2000 | 0.0023 | - | | 0.1493 | 2050 | 0.002 | - | | 0.1529 | 2100 | 0.0033 | - | | 0.1566 | 2150 | 0.0032 | - | | 0.1602 | 2200 | 0.0048 | - | | 0.1638 | 2250 | 0.004 | - | | 0.1675 | 2300 | 0.0032 | - | | 0.1711 | 2350 | 0.0033 | - | | 0.1748 | 2400 | 0.0036 | - | | 0.1784 | 2450 | 0.0031 | - | | 0.1820 | 2500 | 0.0024 | - | | 0.1857 | 2550 | 0.0016 | - | | 0.1893 | 2600 | 0.0024 | - | | 0.1930 | 2650 | 0.0034 | - | | 0.1966 | 2700 | 0.0022 | - | | 0.2002 | 2750 | 0.0021 | - | | 0.2039 | 2800 | 0.0022 | - | | 0.2075 | 2850 | 0.0012 | - | | 0.2112 | 2900 | 0.0022 | - | | 0.2148 | 2950 | 0.001 | - | | 0.2185 | 3000 | 0.0007 | - | | 0.2221 | 3050 | 0.0011 | - | | 0.2257 | 3100 | 0.0008 | - | | 0.2294 | 3150 | 0.0008 | - | | 0.2330 | 3200 | 0.0016 | - | | 0.2367 | 3250 | 0.0026 | - | | 0.2403 | 3300 | 0.0018 | - | | 0.2439 | 3350 | 0.0021 | - | | 0.2476 | 3400 | 0.001 | - | | 0.2512 | 3450 | 0.002 | - | | 0.2549 | 3500 | 0.0017 | - | | 0.2585 | 3550 | 0.0011 | - | | 0.2621 | 3600 | 0.0007 | - | | 0.2658 | 3650 | 0.0019 | - | | 0.2694 | 3700 | 0.0023 | - | | 0.2731 | 3750 | 0.0022 | - | | 0.2767 | 3800 | 0.0015 | - | | 0.2803 | 3850 | 0.0016 | - | | 0.2840 | 3900 | 0.0017 | - | | 0.2876 | 3950 | 0.0041 | - | | 0.2913 | 4000 | 0.0028 | - | | 0.2949 | 4050 | 0.0032 | - | | 0.2986 | 4100 | 0.004 | - | | 0.3022 | 4150 | 0.0025 | - | | 0.3058 | 4200 | 0.0026 | - | | 0.3095 | 4250 | 0.0024 | - | | 0.3131 | 4300 | 0.0015 | - | | 0.3168 | 4350 | 0.0013 | - | | 0.3204 | 4400 | 0.0026 | - | | 0.3240 | 4450 | 0.0017 | - | | 0.3277 | 4500 | 0.0015 | - | | 0.3313 | 4550 | 0.0013 | - | | 0.3350 | 4600 | 0.0012 | - | | 0.3386 | 4650 | 0.0009 | - | | 0.3422 | 4700 | 0.0008 | - | | 0.3459 | 4750 | 0.0009 | - | | 0.3495 | 4800 | 0.0005 | - | | 0.3532 | 4850 | 0.0005 | - | | 0.3568 | 4900 | 0.001 | - | | 0.3604 | 4950 | 0.0005 | - | | 0.3641 | 5000 | 0.0003 | - | | 0.3677 | 5050 | 0.0011 | - | | 0.3714 | 5100 | 0.0006 | - | | 0.3750 | 5150 | 0.0007 | - | | 0.3786 | 5200 | 0.0006 | - | | 0.3823 | 5250 | 0.0007 | - | | 0.3859 | 5300 | 0.0005 | - | | 0.3896 | 5350 | 0.001 | - | | 0.3932 | 5400 | 0.0006 | - | | 0.3969 | 5450 | 0.0011 | - | | 0.4005 | 5500 | 0.0009 | - | | 0.4041 | 5550 | 0.001 | - | | 0.4078 | 5600 | 0.001 | - | | 0.4114 | 5650 | 0.0011 | - | | 0.4151 | 5700 | 0.0007 | - | | 0.4187 | 5750 | 0.0008 | - | | 0.4223 | 5800 | 0.0009 | - | | 0.4260 | 5850 | 0.0004 | - | | 0.4296 | 5900 | 0.0007 | - | | 0.4333 | 5950 | 0.0005 | - | | 0.4369 | 6000 | 0.0011 | - | | 0.4405 | 6050 | 0.0007 | - | | 0.4442 | 6100 | 0.0007 | - | | 0.4478 | 6150 | 0.0003 | - | | 0.4515 | 6200 | 0.0004 | - | | 0.4551 | 6250 | 0.0006 | - | | 0.4587 | 6300 | 0.0003 | - | | 0.4624 | 6350 | 0.001 | - | | 0.4660 | 6400 | 0.0006 | - | | 0.4697 | 6450 | 0.0009 | - | | 0.4733 | 6500 | 0.0008 | - | | 0.4770 | 6550 | 0.0009 | - | | 0.4806 | 6600 | 0.0005 | - | | 0.4842 | 6650 | 0.0009 | - | | 0.4879 | 6700 | 0.0009 | - | | 0.4915 | 6750 | 0.0012 | - | | 0.4952 | 6800 | 0.0004 | - | | 0.4988 | 6850 | 0.0005 | - | | 0.5024 | 6900 | 0.0009 | - | | 0.5061 | 6950 | 0.0014 | - | | 0.5097 | 7000 | 0.0005 | - | | 0.5134 | 7050 | 0.0007 | - | | 0.5170 | 7100 | 0.0009 | - | | 0.5206 | 7150 | 0.0011 | - | | 0.5243 | 7200 | 0.001 | - | | 0.5279 | 7250 | 0.0021 | - | | 0.5316 | 7300 | 0.0015 | - | | 0.5352 | 7350 | 0.001 | - | | 0.5388 | 7400 | 0.001 | - | | 0.5425 | 7450 | 0.0018 | - | | 0.5461 | 7500 | 0.0009 | - | | 0.5498 | 7550 | 0.0008 | - | | 0.5534 | 7600 | 0.0004 | - | | 0.5571 | 7650 | 0.0007 | - | | 0.5607 | 7700 | 0.0009 | - | | 0.5643 | 7750 | 0.0011 | - | | 0.5680 | 7800 | 0.0006 | - | | 0.5716 | 7850 | 0.0016 | - | | 0.5753 | 7900 | 0.0016 | - | | 0.5789 | 7950 | 0.0009 | - | | 0.5825 | 8000 | 0.0017 | - | | 0.5862 | 8050 | 0.0017 | - | | 0.5898 | 8100 | 0.001 | - | | 0.5935 | 8150 | 0.001 | - | | 0.5971 | 8200 | 0.0005 | - | | 0.6007 | 8250 | 0.0008 | - | | 0.6044 | 8300 | 0.0003 | - | | 0.6080 | 8350 | 0.0005 | - | | 0.6117 | 8400 | 0.0006 | - | | 0.6153 | 8450 | 0.0006 | - | | 0.6189 | 8500 | 0.0007 | - | | 0.6226 | 8550 | 0.0006 | - | | 0.6262 | 8600 | 0.0007 | - | | 0.6299 | 8650 | 0.0008 | - | | 0.6335 | 8700 | 0.0005 | - | | 0.6372 | 8750 | 0.001 | - | | 0.6408 | 8800 | 0.0011 | - | | 0.6444 | 8850 | 0.0008 | - | | 0.6481 | 8900 | 0.0008 | - | | 0.6517 | 8950 | 0.0007 | - | | 0.6554 | 9000 | 0.0006 | - | | 0.6590 | 9050 | 0.0008 | - | | 0.6626 | 9100 | 0.0004 | - | | 0.6663 | 9150 | 0.0007 | - | | 0.6699 | 9200 | 0.0007 | - | | 0.6736 | 9250 | 0.0002 | - | | 0.6772 | 9300 | 0.0007 | - | | 0.6808 | 9350 | 0.0007 | - | | 0.6845 | 9400 | 0.0006 | - | | 0.6881 | 9450 | 0.0007 | - | | 0.6918 | 9500 | 0.0009 | - | | 0.6954 | 9550 | 0.0007 | - | | 0.6990 | 9600 | 0.0006 | - | | 0.7027 | 9650 | 0.0009 | - | | 0.7063 | 9700 | 0.0005 | - | | 0.7100 | 9750 | 0.0006 | - | | 0.7136 | 9800 | 0.001 | - | | 0.7173 | 9850 | 0.0004 | - | | 0.7209 | 9900 | 0.0006 | - | | 0.7245 | 9950 | 0.0006 | - | | 0.7282 | 10000 | 0.0003 | - | | 0.7318 | 10050 | 0.0009 | - | | 0.7355 | 10100 | 0.0006 | - | | 0.7391 | 10150 | 0.0011 | - | | 0.7427 | 10200 | 0.0008 | - | | 0.7464 | 10250 | 0.0006 | - | | 0.7500 | 10300 | 0.0008 | - | | 0.7537 | 10350 | 0.0006 | - | | 0.7573 | 10400 | 0.0005 | - | | 0.7609 | 10450 | 0.0008 | - | | 0.7646 | 10500 | 0.0007 | - | | 0.7682 | 10550 | 0.0005 | - | | 0.7719 | 10600 | 0.0007 | - | | 0.7755 | 10650 | 0.0011 | - | | 0.7791 | 10700 | 0.0011 | - | | 0.7828 | 10750 | 0.0008 | - | | 0.7864 | 10800 | 0.0003 | - | | 0.7901 | 10850 | 0.0006 | - | | 0.7937 | 10900 | 0.0009 | - | | 0.7973 | 10950 | 0.0006 | - | | 0.8010 | 11000 | 0.0008 | - | | 0.8046 | 11050 | 0.0005 | - | | 0.8083 | 11100 | 0.0014 | - | | 0.8119 | 11150 | 0.0007 | - | | 0.8156 | 11200 | 0.0004 | - | | 0.8192 | 11250 | 0.001 | - | | 0.8228 | 11300 | 0.0005 | - | | 0.8265 | 11350 | 0.0003 | - | | 0.8301 | 11400 | 0.0005 | - | | 0.8338 | 11450 | 0.0003 | - | | 0.8374 | 11500 | 0.0004 | - | | 0.8410 | 11550 | 0.0006 | - | | 0.8447 | 11600 | 0.0006 | - | | 0.8483 | 11650 | 0.0006 | - | | 0.8520 | 11700 | 0.0005 | - | | 0.8556 | 11750 | 0.0008 | - | | 0.8592 | 11800 | 0.0009 | - | | 0.8629 | 11850 | 0.0007 | - | | 0.8665 | 11900 | 0.0012 | - | | 0.8702 | 11950 | 0.0003 | - | | 0.8738 | 12000 | 0.0006 | - | | 0.8774 | 12050 | 0.0007 | - | | 0.8811 | 12100 | 0.0008 | - | | 0.8847 | 12150 | 0.0003 | - | | 0.8884 | 12200 | 0.0006 | - | | 0.8920 | 12250 | 0.0006 | - | | 0.8957 | 12300 | 0.0004 | - | | 0.8993 | 12350 | 0.0005 | - | | 0.9029 | 12400 | 0.0005 | - | | 0.9066 | 12450 | 0.0006 | - | | 0.9102 | 12500 | 0.0004 | - | | 0.9139 | 12550 | 0.0005 | - | | 0.9175 | 12600 | 0.0003 | - | | 0.9211 | 12650 | 0.0004 | - | | 0.9248 | 12700 | 0.0005 | - | | 0.9284 | 12750 | 0.0006 | - | | 0.9321 | 12800 | 0.0004 | - | | 0.9357 | 12850 | 0.0005 | - | | 0.9393 | 12900 | 0.0005 | - | | 0.9430 | 12950 | 0.0011 | - | | 0.9466 | 13000 | 0.0004 | - | | 0.9503 | 13050 | 0.0007 | - | | 0.9539 | 13100 | 0.0005 | - | | 0.9575 | 13150 | 0.0006 | - | | 0.9612 | 13200 | 0.0005 | - | | 0.9648 | 13250 | 0.0007 | - | | 0.9685 | 13300 | 0.0007 | - | | 0.9721 | 13350 | 0.0004 | - | | 0.9758 | 13400 | 0.0005 | - | | 0.9794 | 13450 | 0.0005 | - | | 0.9830 | 13500 | 0.0004 | - | | 0.9867 | 13550 | 0.0006 | - | | 0.9903 | 13600 | 0.0004 | - | | 0.9940 | 13650 | 0.0007 | - | | 0.9976 | 13700 | 0.0007 | - | ### Framework Versions - Python: 3.12.11 - SetFit: 1.1.3 - Sentence Transformers: 5.1.0 - Transformers: 4.54.1 - PyTorch: 2.7.1 - Datasets: 4.0.0 - Tokenizers: 0.21.4 ## 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} } ```