SetFit with desarrolloasesoreslocales/bert-leg-al-corpus
This is a SetFit model that can be used for Text Classification. This SetFit model uses desarrolloasesoreslocales/bert-leg-al-corpus 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:
- Fine-tuning a Sentence Transformer with contrastive learning.
- Training a classification head with features from the fine-tuned Sentence Transformer.
Model Details
Model Description
- Model Type: SetFit
- Sentence Transformer body: desarrolloasesoreslocales/bert-leg-al-corpus
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 512 tokens
- Number of Classes: 21 classes
Model Sources
- Repository: SetFit on GitHub
- Paper: Efficient Few-Shot Learning Without Prompts
- Blogpost: SetFit: Efficient Few-Shot Learning Without Prompts
Model Labels
Label | Examples |
---|---|
2060 |
|
2037 |
|
2027 |
|
2002 |
|
237 |
|
2022 |
|
2026 |
|
2039 |
|
2038 |
|
353 |
|
304 |
|
2001 |
|
2014 |
|
49 |
|
78 |
|
1001 |
|
357 |
|
2017 |
|
2013 |
|
994 |
|
2010 |
|
Evaluation
Metrics
Label | Accuracy |
---|---|
all | 0.9127 |
Uses
Direct Use for Inference
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("desarrolloasesoreslocales/bert-leg-al-setfit")
# Run inference
preds = model("En relación a la cuantía económica impuesta y en base al principio de
proporcionalidad, creo que es excesiva.")
Training Details
Training Set Metrics
Training set | Min | Median | Max |
---|---|---|---|
Word count | 3 | 30.9507 | 213 |
Label | Training Sample Count |
---|---|
49 | 34 |
78 | 34 |
237 | 33 |
304 | 34 |
353 | 34 |
357 | 34 |
994 | 34 |
1001 | 34 |
2001 | 34 |
2002 | 34 |
2010 | 34 |
2013 | 34 |
2014 | 34 |
2017 | 34 |
2022 | 33 |
2026 | 34 |
2027 | 33 |
2037 | 33 |
2038 | 34 |
2039 | 34 |
2060 | 34 |
Training Hyperparameters
- batch_size: (32, 32)
- num_epochs: (2, 2)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 60
- body_learning_rate: (1e-06, 1e-06)
- head_learning_rate: 0.0002
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: True
- use_amp: True
- 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.0004 | 1 | 0.3326 | - |
0.0075 | 20 | 0.352 | 0.3591 |
0.0150 | 40 | 0.3662 | 0.3591 |
0.0225 | 60 | 0.3348 | 0.3589 |
0.0300 | 80 | 0.3773 | 0.3588 |
0.0376 | 100 | 0.3523 | 0.3585 |
0.0451 | 120 | 0.36 | 0.3582 |
0.0526 | 140 | 0.3726 | 0.3579 |
0.0601 | 160 | 0.3715 | 0.3575 |
0.0676 | 180 | 0.3519 | 0.357 |
0.0751 | 200 | 0.3611 | 0.3565 |
0.0826 | 220 | 0.3635 | 0.356 |
0.0901 | 240 | 0.3594 | 0.3553 |
0.0976 | 260 | 0.3383 | 0.3546 |
0.1051 | 280 | 0.3393 | 0.3539 |
0.1127 | 300 | 0.3299 | 0.353 |
0.1202 | 320 | 0.3044 | 0.3522 |
0.1277 | 340 | 0.3433 | 0.3512 |
0.1352 | 360 | 0.3564 | 0.3503 |
0.1427 | 380 | 0.3365 | 0.3493 |
0.1502 | 400 | 0.3721 | 0.3481 |
0.1577 | 420 | 0.3636 | 0.3469 |
0.1652 | 440 | 0.3661 | 0.3457 |
0.1727 | 460 | 0.351 | 0.3443 |
0.1802 | 480 | 0.327 | 0.3433 |
0.1878 | 500 | 0.3447 | 0.3417 |
0.1953 | 520 | 0.3271 | 0.34 |
0.2028 | 540 | 0.3364 | 0.3383 |
0.2103 | 560 | 0.298 | 0.3366 |
0.2178 | 580 | 0.3392 | - |
0.0004 | 1 | 0.3057 | - |
0.0075 | 20 | 0.3281 | 0.3341 |
0.0150 | 40 | 0.3415 | 0.332 |
0.0225 | 60 | 0.3017 | 0.3285 |
0.0300 | 80 | 0.3462 | 0.3232 |
0.0376 | 100 | 0.3056 | 0.3156 |
0.0451 | 120 | 0.3111 | 0.3063 |
0.0526 | 140 | 0.3136 | 0.2955 |
0.0601 | 160 | 0.3067 | 0.2802 |
0.0676 | 180 | 0.2645 | 0.2593 |
0.0751 | 200 | 0.2517 | 0.233 |
0.0826 | 220 | 0.212 | 0.2077 |
0.0901 | 240 | 0.1686 | 0.1881 |
0.0976 | 260 | 0.1783 | 0.1731 |
0.1051 | 280 | 0.1268 | 0.1592 |
0.1127 | 300 | 0.137 | 0.1474 |
0.1202 | 320 | 0.1372 | 0.1376 |
0.1277 | 340 | 0.146 | 0.1287 |
0.1352 | 360 | 0.1579 | 0.1226 |
0.1427 | 380 | 0.1037 | 0.1162 |
0.1502 | 400 | 0.1391 | 0.1105 |
0.1577 | 420 | 0.136 | 0.1053 |
0.1652 | 440 | 0.1212 | 0.1013 |
0.1727 | 460 | 0.128 | 0.098 |
0.1802 | 480 | 0.0701 | 0.0944 |
0.1878 | 500 | 0.1274 | 0.0913 |
0.1953 | 520 | 0.1235 | 0.0882 |
0.2028 | 540 | 0.0761 | 0.0857 |
0.2103 | 560 | 0.0942 | 0.0833 |
0.2178 | 580 | 0.1046 | 0.0815 |
0.2253 | 600 | 0.0812 | 0.0795 |
0.2328 | 620 | 0.0888 | 0.0776 |
0.2403 | 640 | 0.0867 | 0.076 |
0.2478 | 660 | 0.0997 | 0.0743 |
0.2554 | 680 | 0.1344 | 0.0728 |
0.2629 | 700 | 0.07 | 0.0716 |
0.2704 | 720 | 0.1014 | 0.0703 |
0.2779 | 740 | 0.125 | 0.0692 |
0.2854 | 760 | 0.078 | 0.0674 |
0.2929 | 780 | 0.062 | 0.0666 |
0.3004 | 800 | 0.1564 | 0.0659 |
0.3079 | 820 | 0.0957 | 0.0648 |
0.3154 | 840 | 0.1069 | 0.0635 |
0.3229 | 860 | 0.0982 | 0.0622 |
0.3305 | 880 | 0.0384 | 0.0608 |
0.3380 | 900 | 0.1394 | 0.0597 |
0.3455 | 920 | 0.0349 | 0.0591 |
0.3530 | 940 | 0.087 | 0.0579 |
0.3605 | 960 | 0.0878 | 0.0571 |
0.3680 | 980 | 0.0695 | 0.0565 |
0.3755 | 1000 | 0.0437 | 0.0556 |
0.3830 | 1020 | 0.0431 | 0.0551 |
0.3905 | 1040 | 0.0391 | 0.0545 |
0.3980 | 1060 | 0.0936 | 0.0544 |
0.4056 | 1080 | 0.066 | 0.054 |
0.4131 | 1100 | 0.1169 | 0.0534 |
0.4206 | 1120 | 0.0445 | 0.0525 |
0.4281 | 1140 | 0.0365 | 0.0519 |
0.4356 | 1160 | 0.0714 | 0.0517 |
0.4431 | 1180 | 0.043 | 0.051 |
0.4506 | 1200 | 0.0754 | 0.0506 |
0.4581 | 1220 | 0.0592 | 0.0501 |
0.4656 | 1240 | 0.0775 | 0.0498 |
0.4732 | 1260 | 0.0601 | 0.0494 |
0.4807 | 1280 | 0.0903 | 0.0486 |
0.4882 | 1300 | 0.0518 | 0.0481 |
0.4957 | 1320 | 0.0462 | 0.0477 |
0.5032 | 1340 | 0.0413 | 0.0477 |
0.5107 | 1360 | 0.044 | 0.0473 |
0.5182 | 1380 | 0.0724 | 0.047 |
0.5257 | 1400 | 0.0433 | 0.0468 |
0.5332 | 1420 | 0.0511 | 0.0465 |
0.5407 | 1440 | 0.065 | 0.0462 |
0.5483 | 1460 | 0.0611 | 0.0458 |
0.5558 | 1480 | 0.0419 | 0.0459 |
0.5633 | 1500 | 0.0595 | 0.0456 |
0.5708 | 1520 | 0.0718 | 0.0452 |
0.5783 | 1540 | 0.0577 | 0.0449 |
0.5858 | 1560 | 0.0515 | 0.0447 |
0.5933 | 1580 | 0.0388 | 0.0444 |
0.6008 | 1600 | 0.0764 | 0.0443 |
0.6083 | 1620 | 0.0876 | 0.0441 |
0.6158 | 1640 | 0.0361 | 0.0436 |
0.6234 | 1660 | 0.0549 | 0.0435 |
0.6309 | 1680 | 0.0207 | 0.0434 |
0.6384 | 1700 | 0.0366 | 0.0434 |
0.6459 | 1720 | 0.0342 | 0.0433 |
0.6534 | 1740 | 0.0313 | 0.043 |
0.6609 | 1760 | 0.0342 | 0.0432 |
0.6684 | 1780 | 0.0744 | 0.0429 |
0.6759 | 1800 | 0.0282 | 0.0428 |
0.6834 | 1820 | 0.0479 | 0.0429 |
0.6910 | 1840 | 0.0497 | 0.0426 |
0.6985 | 1860 | 0.0513 | 0.0426 |
0.7060 | 1880 | 0.02 | 0.0423 |
0.7135 | 1900 | 0.0238 | 0.0424 |
0.7210 | 1920 | 0.0446 | 0.0422 |
0.7285 | 1940 | 0.0853 | 0.0419 |
0.7360 | 1960 | 0.0234 | 0.0416 |
0.7435 | 1980 | 0.0646 | 0.0416 |
0.7510 | 2000 | 0.0387 | 0.0419 |
0.7585 | 2020 | 0.0419 | 0.0416 |
0.7661 | 2040 | 0.0326 | 0.0419 |
0.7736 | 2060 | 0.0344 | 0.0414 |
0.7811 | 2080 | 0.0246 | 0.041 |
0.7886 | 2100 | 0.0383 | 0.0408 |
0.7961 | 2120 | 0.0315 | 0.0407 |
0.8036 | 2140 | 0.0408 | 0.0406 |
0.8111 | 2160 | 0.0293 | 0.0403 |
0.8186 | 2180 | 0.0242 | 0.0405 |
0.8261 | 2200 | 0.0317 | 0.0399 |
0.8336 | 2220 | 0.0416 | 0.0396 |
0.8412 | 2240 | 0.0503 | 0.0395 |
0.8487 | 2260 | 0.0468 | 0.0394 |
0.8562 | 2280 | 0.0231 | 0.0395 |
0.8637 | 2300 | 0.0363 | 0.0394 |
0.8712 | 2320 | 0.0423 | 0.0395 |
0.8787 | 2340 | 0.0321 | 0.0391 |
0.8862 | 2360 | 0.0226 | 0.0391 |
0.8937 | 2380 | 0.0567 | 0.039 |
0.9012 | 2400 | 0.0421 | 0.039 |
0.9087 | 2420 | 0.0462 | 0.0389 |
0.9163 | 2440 | 0.0109 | 0.0388 |
0.9238 | 2460 | 0.0209 | 0.039 |
0.9313 | 2480 | 0.0133 | 0.0387 |
0.9388 | 2500 | 0.0309 | 0.0386 |
0.9463 | 2520 | 0.0179 | 0.0386 |
0.9538 | 2540 | 0.0288 | 0.0387 |
0.9613 | 2560 | 0.0434 | 0.0388 |
0.9688 | 2580 | 0.0307 | 0.0387 |
0.9763 | 2600 | 0.0396 | 0.039 |
0.9839 | 2620 | 0.0418 | 0.0385 |
0.9914 | 2640 | 0.0115 | 0.0385 |
0.9989 | 2660 | 0.0416 | 0.0386 |
1.0064 | 2680 | 0.0236 | 0.0385 |
1.0139 | 2700 | 0.0302 | 0.0385 |
1.0214 | 2720 | 0.0261 | 0.0385 |
1.0289 | 2740 | 0.0184 | 0.0388 |
1.0364 | 2760 | 0.0364 | 0.0385 |
1.0439 | 2780 | 0.0253 | 0.0385 |
1.0514 | 2800 | 0.0271 | 0.0385 |
1.0590 | 2820 | 0.0056 | 0.0385 |
1.0665 | 2840 | 0.0327 | 0.0384 |
1.0740 | 2860 | 0.0237 | 0.0381 |
1.0815 | 2880 | 0.0375 | 0.0383 |
1.0890 | 2900 | 0.0204 | 0.038 |
1.0965 | 2920 | 0.0551 | 0.0379 |
1.1040 | 2940 | 0.0274 | 0.038 |
1.1115 | 2960 | 0.0136 | 0.038 |
1.1190 | 2980 | 0.0193 | 0.0381 |
1.1265 | 3000 | 0.0449 | 0.0376 |
1.1341 | 3020 | 0.0403 | 0.0376 |
1.1416 | 3040 | 0.0237 | 0.0372 |
1.1491 | 3060 | 0.0133 | 0.037 |
1.1566 | 3080 | 0.0313 | 0.037 |
1.1641 | 3100 | 0.0205 | 0.0369 |
1.1716 | 3120 | 0.0274 | 0.0371 |
1.1791 | 3140 | 0.0178 | 0.0372 |
1.1866 | 3160 | 0.0258 | 0.0375 |
1.1941 | 3180 | 0.0466 | 0.0371 |
1.2017 | 3200 | 0.0258 | 0.037 |
1.2092 | 3220 | 0.0277 | 0.0371 |
1.2167 | 3240 | 0.0137 | 0.0371 |
1.2242 | 3260 | 0.0232 | 0.0372 |
1.2317 | 3280 | 0.0267 | 0.0371 |
1.2392 | 3300 | 0.0126 | 0.0375 |
1.2467 | 3320 | 0.0514 | 0.0372 |
1.2542 | 3340 | 0.0175 | 0.0373 |
1.2617 | 3360 | 0.0188 | 0.0374 |
1.2692 | 3380 | 0.0137 | 0.0372 |
1.2768 | 3400 | 0.035 | 0.0372 |
1.2843 | 3420 | 0.0309 | 0.0371 |
1.2918 | 3440 | 0.0462 | 0.0373 |
1.2993 | 3460 | 0.0388 | 0.0371 |
1.3068 | 3480 | 0.0573 | 0.0372 |
1.3143 | 3500 | 0.02 | 0.0373 |
1.3218 | 3520 | 0.0376 | 0.0372 |
1.3293 | 3540 | 0.0165 | 0.0374 |
1.3368 | 3560 | 0.0118 | 0.0372 |
1.3443 | 3580 | 0.0167 | 0.0374 |
1.3519 | 3600 | 0.0137 | 0.0373 |
1.3594 | 3620 | 0.0044 | 0.0371 |
1.3669 | 3640 | 0.0085 | 0.037 |
1.3744 | 3660 | 0.0336 | 0.0368 |
1.3819 | 3680 | 0.0217 | 0.0369 |
1.3894 | 3700 | 0.0395 | 0.0369 |
1.3969 | 3720 | 0.033 | 0.0371 |
1.4044 | 3740 | 0.0173 | 0.0368 |
1.4119 | 3760 | 0.0126 | 0.0367 |
1.4195 | 3780 | 0.012 | 0.0367 |
1.4270 | 3800 | 0.0364 | 0.0366 |
1.4345 | 3820 | 0.0238 | 0.0366 |
1.4420 | 3840 | 0.0199 | 0.0365 |
1.4495 | 3860 | 0.0152 | 0.0368 |
1.4570 | 3880 | 0.035 | 0.0366 |
1.4645 | 3900 | 0.0413 | 0.0365 |
1.4720 | 3920 | 0.0208 | 0.0366 |
1.4795 | 3940 | 0.0074 | 0.0366 |
1.4870 | 3960 | 0.0116 | 0.0366 |
1.4946 | 3980 | 0.0088 | 0.0365 |
1.5021 | 4000 | 0.0264 | 0.0367 |
1.5096 | 4020 | 0.0161 | 0.0363 |
1.5171 | 4040 | 0.0549 | 0.0362 |
1.5246 | 4060 | 0.0166 | 0.0362 |
1.5321 | 4080 | 0.0162 | 0.0361 |
1.5396 | 4100 | 0.0174 | 0.0363 |
1.5471 | 4120 | 0.0231 | 0.0362 |
1.5546 | 4140 | 0.0143 | 0.0364 |
1.5621 | 4160 | 0.0168 | 0.0361 |
1.5697 | 4180 | 0.0149 | 0.0361 |
1.5772 | 4200 | 0.013 | 0.0361 |
1.5847 | 4220 | 0.0122 | 0.0361 |
1.5922 | 4240 | 0.0061 | 0.0362 |
1.5997 | 4260 | 0.0088 | 0.0361 |
1.6072 | 4280 | 0.0071 | 0.0364 |
1.6147 | 4300 | 0.0168 | 0.0361 |
1.6222 | 4320 | 0.0333 | 0.0361 |
1.6297 | 4340 | 0.0487 | 0.0362 |
1.6373 | 4360 | 0.0177 | 0.0361 |
1.6448 | 4380 | 0.0086 | 0.0361 |
1.6523 | 4400 | 0.0244 | 0.036 |
1.6598 | 4420 | 0.0294 | 0.0362 |
1.6673 | 4440 | 0.0134 | 0.0359 |
1.6748 | 4460 | 0.0081 | 0.0358 |
1.6823 | 4480 | 0.011 | 0.0357 |
1.6898 | 4500 | 0.0453 | 0.0357 |
1.6973 | 4520 | 0.0269 | 0.0358 |
1.7048 | 4540 | 0.039 | 0.0357 |
1.7124 | 4560 | 0.0346 | 0.036 |
1.7199 | 4580 | 0.0164 | 0.0357 |
1.7274 | 4600 | 0.0081 | 0.0356 |
1.7349 | 4620 | 0.0343 | 0.0357 |
1.7424 | 4640 | 0.0071 | 0.0356 |
1.7499 | 4660 | 0.0349 | 0.0357 |
1.7574 | 4680 | 0.0128 | 0.0356 |
1.7649 | 4700 | 0.0128 | 0.0359 |
1.7724 | 4720 | 0.0375 | 0.0356 |
1.7799 | 4740 | 0.0257 | 0.0356 |
1.7875 | 4760 | 0.0514 | 0.0355 |
1.7950 | 4780 | 0.0077 | 0.0354 |
1.8025 | 4800 | 0.0281 | 0.0355 |
1.8100 | 4820 | 0.0236 | 0.0354 |
1.8175 | 4840 | 0.0097 | 0.0357 |
1.8250 | 4860 | 0.0195 | 0.0354 |
1.8325 | 4880 | 0.0057 | 0.0353 |
1.8400 | 4900 | 0.0213 | 0.0354 |
1.8475 | 4920 | 0.0059 | 0.0353 |
1.8551 | 4940 | 0.0237 | 0.0354 |
1.8626 | 4960 | 0.0189 | 0.0354 |
1.8701 | 4980 | 0.0352 | 0.0356 |
1.8776 | 5000 | 0.0069 | 0.0354 |
1.8851 | 5020 | 0.0067 | 0.0354 |
1.8926 | 5040 | 0.0151 | 0.0354 |
1.9001 | 5060 | 0.0107 | 0.0354 |
1.9076 | 5080 | 0.026 | 0.0355 |
1.9151 | 5100 | 0.0764 | 0.0354 |
1.9226 | 5120 | 0.0372 | 0.0357 |
1.9302 | 5140 | 0.0162 | 0.0354 |
1.9377 | 5160 | 0.0276 | 0.0353 |
1.9452 | 5180 | 0.0306 | 0.0354 |
1.9527 | 5200 | 0.0211 | 0.0353 |
1.9602 | 5220 | 0.0252 | 0.0354 |
1.9677 | 5240 | 0.0247 | 0.0354 |
1.9752 | 5260 | 0.0239 | 0.0356 |
1.9827 | 5280 | 0.0245 | 0.0354 |
1.9902 | 5300 | 0.0144 | 0.0353 |
1.9977 | 5320 | 0.0153 | 0.0353 |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.10.12
- SetFit: 1.0.3
- Sentence Transformers: 3.0.1
- Transformers: 4.40.2
- PyTorch: 2.3.1+cu121
- Datasets: 2.20.0
- Tokenizers: 0.19.1
Citation
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}
}
- Downloads last month
- 184
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for desarrolloasesoreslocales/bert-leg-al-setfit
Base model
joelniklaus/legal-xlm-roberta-base