--- base_model: cross-encoder/ms-marco-MiniLM-L-4-v2 library_name: setfit metrics: - accuracy pipeline_tag: text-classification tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: He de prendre la decisió de renunciar a una subvenció que no es pot ajustar als nostres objectius. - text: Com a família de baixos ingressos, quin és el límit d'ingressos per aconseguir la reducció de la quota? - text: Necessito una llicència per accedir a la meva propietat amb vehicle. - text: Vull aprofitar l'oportunitat de l'ajut per a la creació de la meva pròpia empresa com a treballador autònom. - text: Estic buscant una manera de finançar les meves despeses de hipoteca per la meva empresa. inference: true model-index: - name: SetFit with cross-encoder/ms-marco-MiniLM-L-4-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.1060126582278481 name: Accuracy --- # SetFit with cross-encoder/ms-marco-MiniLM-L-4-v2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [cross-encoder/ms-marco-MiniLM-L-4-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-4-v2) 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:** [cross-encoder/ms-marco-MiniLM-L-4-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-4-v2) - **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:** 237 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 | |:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 133 | | | 37 | | | 214 | | | 215 | | | 3 | | | 108 | | | 54 | | | 70 | | | 101 | | | 128 | | | 46 | | | 50 | | | 104 | | | 211 | | | 38 | | | 100 | | | 132 | | | 148 | | | 75 | | | 7 | | | 156 | | | 126 | | | 225 | | | 124 | | | 180 | | | 51 | | | 232 | | | 192 | | | 174 | | | 204 | | | 168 | | | 226 | | | 169 | | | 127 | | | 210 | | | 179 | | | 95 | | | 72 | | | 26 | | | 20 | | | 233 | | | 224 | | | 33 | | | 8 | | | 24 | | | 223 | | | 207 | | | 236 | | | 217 | | | 25 | | | 115 | | | 29 | | | 152 | | | 234 | | | 186 | | | 227 | | | 184 | | | 94 | | | 89 | | | 9 | | | 170 | | | 96 | | | 131 | | | 177 | | | 145 | | | 171 | | | 4 | | | 107 | | | 67 | | | 178 | | | 158 | | | 143 | | | 84 | | | 80 | | | 79 | | | 27 | | | 155 | | | 56 | | | 98 | | | 2 | | | 32 | | | 68 | | | 135 | | | 118 | | | 88 | | | 120 | | | 55 | | | 66 | | | 52 | | | 159 | | | 86 | | | 28 | | | 212 | | | 81 | | | 12 | | | 229 | | | 146 | | | 138 | | | 0 | | | 161 | | | 91 | | | 112 | | | 62 | | | 121 | | | 82 | | | 106 | | | 39 | | | 134 | | | 149 | | | 200 | | | 222 | | | 13 | | | 187 | | | 130 | | | 230 | | | 92 | | | 151 | | | 5 | | | 85 | | | 59 | | | 48 | | | 208 | | | 144 | | | 147 | | | 150 | | | 166 | | | 173 | | | 191 | | | 197 | | | 78 | | | 209 | | | 119 | | | 203 | | | 114 | | | 83 | | | 123 | | | 45 | | | 103 | | | 90 | | | 18 | | | 165 | | | 87 | | | 183 | | | 111 | | | 73 | | | 153 | | | 21 | | | 93 | | | 196 | | | 65 | | | 213 | | | 99 | | | 71 | | | 189 | | | 231 | | | 154 | | | 125 | | | 221 | | | 117 | | | 74 | | | 162 | | | 10 | | | 116 | | | 172 | | | 157 | | | 63 | | | 1 | | | 42 | | | 122 | | | 17 | | | 167 | | | 218 | | | 53 | | | 76 | | | 188 | | | 40 | | | 69 | | | 199 | | | 129 | | | 228 | | | 105 | | | 185 | | | 11 | | | 142 | | | 43 | | | 206 | | | 160 | | | 61 | | | 57 | | | 198 | | | 23 | | | 164 | | | 201 | | | 15 | | | 176 | | | 60 | | | 109 | | | 137 | | | 190 | | | 31 | | | 235 | | | 16 | | | 44 | | | 220 | | | 216 | | | 195 | | | 34 | | | 30 | | | 58 | | | 202 | | | 35 | | | 77 | | | 182 | | | 49 | | | 6 | | | 102 | | | 175 | | | 139 | | | 219 | | | 41 | | | 110 | | | 22 | | | 19 | | | 163 | | | 64 | | | 47 | | | 113 | | | 140 | | | 181 | | | 14 | | | 141 | | | 194 | | | 36 | | | 97 | | | 193 | | | 205 | | | 136 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.1060 | ## 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("adriansanz/stsitgesreranking") # Run inference preds = model("Necessito una llicència per accedir a la meva propietat amb vehicle.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 6 | 82.6920 | 393 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 1 | | 1 | 1 | | 2 | 1 | | 3 | 1 | | 4 | 1 | | 5 | 1 | | 6 | 1 | | 7 | 1 | | 8 | 1 | | 9 | 1 | | 10 | 1 | | 11 | 1 | | 12 | 1 | | 13 | 1 | | 14 | 1 | | 15 | 1 | | 16 | 1 | | 17 | 1 | | 18 | 1 | | 19 | 1 | | 20 | 1 | | 21 | 1 | | 22 | 1 | | 23 | 1 | | 24 | 1 | | 25 | 1 | | 26 | 1 | | 27 | 1 | | 28 | 1 | | 29 | 1 | | 30 | 1 | | 31 | 1 | | 32 | 1 | | 33 | 1 | | 34 | 1 | | 35 | 1 | | 36 | 1 | | 37 | 1 | | 38 | 1 | | 39 | 1 | | 40 | 1 | | 41 | 1 | | 42 | 1 | | 43 | 1 | | 44 | 1 | | 45 | 1 | | 46 | 1 | | 47 | 1 | | 48 | 1 | | 49 | 1 | | 50 | 1 | | 51 | 1 | | 52 | 1 | | 53 | 1 | | 54 | 1 | | 55 | 1 | | 56 | 1 | | 57 | 1 | | 58 | 1 | | 59 | 1 | | 60 | 1 | | 61 | 1 | | 62 | 1 | | 63 | 1 | | 64 | 1 | | 65 | 1 | | 66 | 1 | | 67 | 1 | | 68 | 1 | | 69 | 1 | | 70 | 1 | | 71 | 1 | | 72 | 1 | | 73 | 1 | | 74 | 1 | | 75 | 1 | | 76 | 1 | | 77 | 1 | | 78 | 1 | | 79 | 1 | | 80 | 1 | | 81 | 1 | | 82 | 1 | | 83 | 1 | | 84 | 1 | | 85 | 1 | | 86 | 1 | | 87 | 1 | | 88 | 1 | | 89 | 1 | | 90 | 1 | | 91 | 1 | | 92 | 1 | | 93 | 1 | | 94 | 1 | | 95 | 1 | | 96 | 1 | | 97 | 1 | | 98 | 1 | | 99 | 1 | | 100 | 1 | | 101 | 1 | | 102 | 1 | | 103 | 1 | | 104 | 1 | | 105 | 1 | | 106 | 1 | | 107 | 1 | | 108 | 1 | | 109 | 1 | | 110 | 1 | | 111 | 1 | | 112 | 1 | | 113 | 1 | | 114 | 1 | | 115 | 1 | | 116 | 1 | | 117 | 1 | | 118 | 1 | | 119 | 1 | | 120 | 1 | | 121 | 1 | | 122 | 1 | | 123 | 1 | | 124 | 1 | | 125 | 1 | | 126 | 1 | | 127 | 1 | | 128 | 1 | | 129 | 1 | | 130 | 1 | | 131 | 1 | | 132 | 1 | | 133 | 1 | | 134 | 1 | | 135 | 1 | | 136 | 1 | | 137 | 1 | | 138 | 1 | | 139 | 1 | | 140 | 1 | | 141 | 1 | | 142 | 1 | | 143 | 1 | | 144 | 1 | | 145 | 1 | | 146 | 1 | | 147 | 1 | | 148 | 1 | | 149 | 1 | | 150 | 1 | | 151 | 1 | | 152 | 1 | | 153 | 1 | | 154 | 1 | | 155 | 1 | | 156 | 1 | | 157 | 1 | | 158 | 1 | | 159 | 1 | | 160 | 1 | | 161 | 1 | | 162 | 1 | | 163 | 1 | | 164 | 1 | | 165 | 1 | | 166 | 1 | | 167 | 1 | | 168 | 1 | | 169 | 1 | | 170 | 1 | | 171 | 1 | | 172 | 1 | | 173 | 1 | | 174 | 1 | | 175 | 1 | | 176 | 1 | | 177 | 1 | | 178 | 1 | | 179 | 1 | | 180 | 1 | | 181 | 1 | | 182 | 1 | | 183 | 1 | | 184 | 1 | | 185 | 1 | | 186 | 1 | | 187 | 1 | | 188 | 1 | | 189 | 1 | | 190 | 1 | | 191 | 1 | | 192 | 1 | | 193 | 1 | | 194 | 1 | | 195 | 1 | | 196 | 1 | | 197 | 1 | | 198 | 1 | | 199 | 1 | | 200 | 1 | | 201 | 1 | | 202 | 1 | | 203 | 1 | | 204 | 1 | | 205 | 1 | | 206 | 1 | | 207 | 1 | | 208 | 1 | | 209 | 1 | | 210 | 1 | | 211 | 1 | | 212 | 1 | | 213 | 1 | | 214 | 1 | | 215 | 1 | | 216 | 1 | | 217 | 1 | | 218 | 1 | | 219 | 1 | | 220 | 1 | | 221 | 1 | | 222 | 1 | | 223 | 1 | | 224 | 1 | | 225 | 1 | | 226 | 1 | | 227 | 1 | | 228 | 1 | | 229 | 1 | | 230 | 1 | | 231 | 1 | | 232 | 1 | | 233 | 1 | | 234 | 1 | | 235 | 1 | | 236 | 1 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (2, 2) - 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: False - use_amp: False - warmup_proportion: 0.1 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: True ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:-------:|:--------:|:-------------:|:---------------:| | 0.0003 | 1 | 0.4496 | - | | 0.0143 | 50 | 0.4198 | - | | 0.0286 | 100 | 0.3046 | - | | 0.0429 | 150 | 0.3019 | - | | 0.0572 | 200 | 0.1864 | - | | 0.0715 | 250 | 0.1818 | - | | 0.0858 | 300 | 0.0775 | - | | 0.1001 | 350 | 0.1147 | - | | 0.1144 | 400 | 0.0588 | - | | 0.1287 | 450 | 0.0433 | - | | 0.1430 | 500 | 0.0504 | - | | 0.1573 | 550 | 0.0214 | - | | 0.1716 | 600 | 0.034 | - | | 0.1859 | 650 | 0.0438 | - | | 0.2002 | 700 | 0.0677 | - | | 0.2145 | 750 | 0.0255 | - | | 0.2288 | 800 | 0.0309 | - | | 0.2431 | 850 | 0.0227 | - | | 0.2574 | 900 | 0.0751 | - | | 0.2717 | 950 | 0.051 | - | | 0.2860 | 1000 | 0.0131 | - | | 0.3003 | 1050 | 0.0263 | - | | 0.3146 | 1100 | 0.038 | - | | 0.3289 | 1150 | 0.0325 | - | | 0.3432 | 1200 | 0.0745 | - | | 0.3576 | 1250 | 0.017 | - | | 0.3719 | 1300 | 0.0241 | - | | 0.3862 | 1350 | 0.017 | - | | 0.4005 | 1400 | 0.0169 | - | | 0.4148 | 1450 | 0.0188 | - | | 0.4291 | 1500 | 0.0266 | - | | 0.4434 | 1550 | 0.0273 | - | | 0.4577 | 1600 | 0.014 | - | | 0.4720 | 1650 | 0.0314 | - | | 0.4863 | 1700 | 0.0076 | - | | 0.5006 | 1750 | 0.0089 | - | | 0.5149 | 1800 | 0.0406 | - | | 0.5292 | 1850 | 0.013 | - | | 0.5435 | 1900 | 0.0221 | - | | 0.5578 | 1950 | 0.0147 | - | | 0.5721 | 2000 | 0.0332 | - | | 0.5864 | 2050 | 0.0248 | - | | 0.6007 | 2100 | 0.019 | - | | 0.6150 | 2150 | 0.0122 | - | | 0.6293 | 2200 | 0.0158 | - | | 0.6436 | 2250 | 0.0124 | - | | 0.6579 | 2300 | 0.0231 | - | | 0.6722 | 2350 | 0.034 | - | | 0.6865 | 2400 | 0.0133 | - | | 0.7008 | 2450 | 0.0135 | - | | 0.7151 | 2500 | 0.0096 | - | | 0.7294 | 2550 | 0.0127 | - | | 0.7437 | 2600 | 0.0166 | - | | 0.7580 | 2650 | 0.03 | - | | 0.7723 | 2700 | 0.01 | - | | 0.7866 | 2750 | 0.0194 | - | | 0.8009 | 2800 | 0.0147 | - | | 0.8152 | 2850 | 0.0085 | - | | 0.8295 | 2900 | 0.0058 | - | | 0.8438 | 2950 | 0.0369 | - | | 0.8581 | 3000 | 0.0071 | - | | 0.8724 | 3050 | 0.0125 | - | | 0.8867 | 3100 | 0.015 | - | | 0.9010 | 3150 | 0.0136 | - | | 0.9153 | 3200 | 0.0077 | - | | 0.9296 | 3250 | 0.0138 | - | | 0.9439 | 3300 | 0.0167 | - | | 0.9582 | 3350 | 0.008 | - | | 0.9725 | 3400 | 0.0232 | - | | 0.9868 | 3450 | 0.0057 | - | | 1.0 | 3496 | - | 0.1714 | | 1.0011 | 3500 | 0.0138 | - | | 1.0154 | 3550 | 0.0087 | - | | 1.0297 | 3600 | 0.0165 | - | | 1.0441 | 3650 | 0.005 | - | | 1.0584 | 3700 | 0.0117 | - | | 1.0727 | 3750 | 0.0212 | - | | 1.0870 | 3800 | 0.0216 | - | | 1.1013 | 3850 | 0.007 | - | | 1.1156 | 3900 | 0.0304 | - | | 1.1299 | 3950 | 0.0123 | - | | 1.1442 | 4000 | 0.0094 | - | | 1.1585 | 4050 | 0.0102 | - | | 1.1728 | 4100 | 0.0222 | - | | 1.1871 | 4150 | 0.0146 | - | | 1.2014 | 4200 | 0.0189 | - | | 1.2157 | 4250 | 0.0048 | - | | 1.2300 | 4300 | 0.0273 | - | | 1.2443 | 4350 | 0.026 | - | | 1.2586 | 4400 | 0.0075 | - | | 1.2729 | 4450 | 0.0343 | - | | 1.2872 | 4500 | 0.003 | - | | 1.3015 | 4550 | 0.0056 | - | | 1.3158 | 4600 | 0.0163 | - | | 1.3301 | 4650 | 0.0111 | - | | 1.3444 | 4700 | 0.0174 | - | | 1.3587 | 4750 | 0.0103 | - | | 1.3730 | 4800 | 0.0082 | - | | 1.3873 | 4850 | 0.0137 | - | | 1.4016 | 4900 | 0.014 | - | | 1.4159 | 4950 | 0.012 | - | | 1.4302 | 5000 | 0.0175 | - | | 1.4445 | 5050 | 0.01 | - | | 1.4588 | 5100 | 0.0061 | - | | 1.4731 | 5150 | 0.0196 | - | | 1.4874 | 5200 | 0.0124 | - | | 1.5017 | 5250 | 0.0071 | - | | 1.5160 | 5300 | 0.0091 | - | | 1.5303 | 5350 | 0.0063 | - | | 1.5446 | 5400 | 0.0063 | - | | 1.5589 | 5450 | 0.0207 | - | | 1.5732 | 5500 | 0.0103 | - | | 1.5875 | 5550 | 0.0574 | - | | 1.6018 | 5600 | 0.0044 | - | | 1.6161 | 5650 | 0.013 | - | | 1.6304 | 5700 | 0.0183 | - | | 1.6447 | 5750 | 0.0066 | - | | 1.6590 | 5800 | 0.0036 | - | | 1.6733 | 5850 | 0.0068 | - | | 1.6876 | 5900 | 0.0475 | - | | 1.7019 | 5950 | 0.0067 | - | | 1.7162 | 6000 | 0.0076 | - | | 1.7305 | 6050 | 0.0148 | - | | 1.7449 | 6100 | 0.0048 | - | | 1.7592 | 6150 | 0.0112 | - | | 1.7735 | 6200 | 0.0148 | - | | 1.7878 | 6250 | 0.0077 | - | | 1.8021 | 6300 | 0.0073 | - | | 1.8164 | 6350 | 0.0078 | - | | 1.8307 | 6400 | 0.0056 | - | | 1.8450 | 6450 | 0.0088 | - | | 1.8593 | 6500 | 0.01 | - | | 1.8736 | 6550 | 0.0147 | - | | 1.8879 | 6600 | 0.0045 | - | | 1.9022 | 6650 | 0.0054 | - | | 1.9165 | 6700 | 0.0045 | - | | 1.9308 | 6750 | 0.007 | - | | 1.9451 | 6800 | 0.0113 | - | | 1.9594 | 6850 | 0.04 | - | | 1.9737 | 6900 | 0.005 | - | | 1.9880 | 6950 | 0.0158 | - | | **2.0** | **6992** | **-** | **0.1701** | * The bold row denotes the saved checkpoint. ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 3.0.1 - Transformers: 4.39.0 - PyTorch: 2.4.0+cu121 - Datasets: 2.21.0 - Tokenizers: 0.15.2 ## 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} } ```