--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: Un dentista entrega a su paciente un cepillo de dientes. Él - text: Develop an app that uses augmented reality to teach users how to play musical instruments. - text: Complétez la phrase par la bonne réponse - text: 'Utilisez chaque phrase mot à mot comme première phrase du paragraphe correspondant. Veillez à écrire à un niveau approprié pour ce type de lecteur : {{TYPE}}' - text: How about developing a smart gardening system that uses sensors and AI to optimize plant growth and reduce water consumption. pipeline_tag: text-classification inference: true base_model: sentence-transformers/distiluse-base-multilingual-cased-v2 --- # SetFit with sentence-transformers/distiluse-base-multilingual-cased-v2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/distiluse-base-multilingual-cased-v2](https://huggingface.co/sentence-transformers/distiluse-base-multilingual-cased-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:** [sentence-transformers/distiluse-base-multilingual-cased-v2](https://huggingface.co/sentence-transformers/distiluse-base-multilingual-cased-v2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 128 tokens - **Number of Classes:** 12 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 | |:-----------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | role | | | instruction | | | answer | | | emotion | | | context | | | question | | | example | | | escape_hedge | | | style | | | choices | | | tone-of-voice | | | chain-of-thought | | ## 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("Complétez la phrase par la bonne réponse") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:-----| | Word count | 1 | 25.5725 | 1312 | | Label | Training Sample Count | |:-----------------|:----------------------| | role | 1002 | | instruction | 1868 | | answer | 1597 | | style | 492 | | context | 1235 | | question | 825 | | example | 243 | | chain-of-thought | 131 | | tone-of-voice | 146 | | choices | 78 | | escape_hedge | 94 | | emotion | 90 | ### Training Hyperparameters - batch_size: (32, 32) - num_epochs: (3, 3) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 5 - 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.0004 | 1 | 0.4007 | - | | 0.0205 | 50 | 0.3796 | - | | 0.0410 | 100 | 0.2563 | - | | 0.0615 | 150 | 0.2319 | - | | 0.0820 | 200 | 0.1506 | - | | 0.1025 | 250 | 0.1284 | - | | 0.1231 | 300 | 0.1219 | - | | 0.1436 | 350 | 0.1333 | - | | 0.1641 | 400 | 0.1144 | - | | 0.1846 | 450 | 0.1923 | - | | 0.2051 | 500 | 0.071 | - | | 0.2256 | 550 | 0.1102 | - | | 0.2461 | 600 | 0.1363 | - | | 0.2666 | 650 | 0.1613 | - | | 0.2871 | 700 | 0.1283 | - | | 0.3076 | 750 | 0.1074 | - | | 0.3281 | 800 | 0.0999 | - | | 0.3486 | 850 | 0.0457 | - | | 0.3692 | 900 | 0.0325 | - | | 0.3897 | 950 | 0.0243 | - | | 0.4102 | 1000 | 0.0564 | - | | 0.4307 | 1050 | 0.0429 | - | | 0.4512 | 1100 | 0.0457 | - | | 0.4717 | 1150 | 0.0285 | - | | 0.4922 | 1200 | 0.0158 | - | | 0.5127 | 1250 | 0.0192 | - | | 0.5332 | 1300 | 0.0247 | - | | 0.5537 | 1350 | 0.0543 | - | | 0.5742 | 1400 | 0.0448 | - | | 0.5947 | 1450 | 0.0194 | - | | 0.6153 | 1500 | 0.0405 | - | | 0.6358 | 1550 | 0.055 | - | | 0.6563 | 1600 | 0.025 | - | | 0.6768 | 1650 | 0.0096 | - | | 0.6973 | 1700 | 0.0074 | - | | 0.7178 | 1750 | 0.0052 | - | | 0.7383 | 1800 | 0.0009 | - | | 0.7588 | 1850 | 0.0344 | - | | 0.7793 | 1900 | 0.0328 | - | | 0.7998 | 1950 | 0.014 | - | | 0.8203 | 2000 | 0.0325 | - | | 0.8409 | 2050 | 0.0332 | - | | 0.8614 | 2100 | 0.0095 | - | | 0.8819 | 2150 | 0.0022 | - | | 0.9024 | 2200 | 0.0227 | - | | 0.9229 | 2250 | 0.0019 | - | | 0.9434 | 2300 | 0.0072 | - | | 0.9639 | 2350 | 0.0039 | - | | 0.9844 | 2400 | 0.001 | - | | **1.0** | **2438** | **-** | **0.0817** | | 1.0049 | 2450 | 0.0148 | - | | 1.0254 | 2500 | 0.001 | - | | 1.0459 | 2550 | 0.0053 | - | | 1.0664 | 2600 | 0.0054 | - | | 1.0870 | 2650 | 0.0053 | - | | 1.1075 | 2700 | 0.0037 | - | | 1.1280 | 2750 | 0.0089 | - | | 1.1485 | 2800 | 0.0024 | - | | 1.1690 | 2850 | 0.0067 | - | | 1.1895 | 2900 | 0.0006 | - | | 1.2100 | 2950 | 0.0074 | - | | 1.2305 | 3000 | 0.001 | - | | 1.2510 | 3050 | 0.0112 | - | | 1.2715 | 3100 | 0.0015 | - | | 1.2920 | 3150 | 0.0017 | - | | 1.3126 | 3200 | 0.0003 | - | | 1.3331 | 3250 | 0.001 | - | | 1.3536 | 3300 | 0.0061 | - | | 1.3741 | 3350 | 0.006 | - | | 1.3946 | 3400 | 0.0002 | - | | 1.4151 | 3450 | 0.0005 | - | | 1.4356 | 3500 | 0.0023 | - | | 1.4561 | 3550 | 0.0001 | - | | 1.4766 | 3600 | 0.0389 | - | | 1.4971 | 3650 | 0.0008 | - | | 1.5176 | 3700 | 0.0009 | - | | 1.5381 | 3750 | 0.0154 | - | | 1.5587 | 3800 | 0.0007 | - | | 1.5792 | 3850 | 0.0009 | - | | 1.5997 | 3900 | 0.0014 | - | | 1.6202 | 3950 | 0.0004 | - | | 1.6407 | 4000 | 0.0226 | - | | 1.6612 | 4050 | 0.0014 | - | | 1.6817 | 4100 | 0.0135 | - | | 1.7022 | 4150 | 0.0001 | - | | 1.7227 | 4200 | 0.0141 | - | | 1.7432 | 4250 | 0.0012 | - | | 1.7637 | 4300 | 0.0008 | - | | 1.7842 | 4350 | 0.0005 | - | | 1.8048 | 4400 | 0.0003 | - | | 1.8253 | 4450 | 0.0013 | - | | 1.8458 | 4500 | 0.0004 | - | | 1.8663 | 4550 | 0.0003 | - | | 1.8868 | 4600 | 0.0007 | - | | 1.9073 | 4650 | 0.001 | - | | 1.9278 | 4700 | 0.0002 | - | | 1.9483 | 4750 | 0.0421 | - | | 1.9688 | 4800 | 0.0008 | - | | 1.9893 | 4850 | 0.0009 | - | | 2.0 | 4876 | - | 0.09 | | 2.0098 | 4900 | 0.0001 | - | | 2.0304 | 4950 | 0.0007 | - | | 2.0509 | 5000 | 0.0003 | - | | 2.0714 | 5050 | 0.0001 | - | | 2.0919 | 5100 | 0.0001 | - | | 2.1124 | 5150 | 0.0017 | - | | 2.1329 | 5200 | 0.0004 | - | | 2.1534 | 5250 | 0.0001 | - | | 2.1739 | 5300 | 0.0013 | - | | 2.1944 | 5350 | 0.0002 | - | | 2.2149 | 5400 | 0.0009 | - | | 2.2354 | 5450 | 0.0197 | - | | 2.2559 | 5500 | 0.0287 | - | | 2.2765 | 5550 | 0.0009 | - | | 2.2970 | 5600 | 0.0116 | - | | 2.3175 | 5650 | 0.0002 | - | | 2.3380 | 5700 | 0.0003 | - | | 2.3585 | 5750 | 0.002 | - | | 2.3790 | 5800 | 0.0315 | - | | 2.3995 | 5850 | 0.0001 | - | | 2.4200 | 5900 | 0.0003 | - | | 2.4405 | 5950 | 0.0001 | - | | 2.4610 | 6000 | 0.0003 | - | | 2.4815 | 6050 | 0.0005 | - | | 2.5021 | 6100 | 0.0001 | - | | 2.5226 | 6150 | 0.0001 | - | | 2.5431 | 6200 | 0.0001 | - | | 2.5636 | 6250 | 0.0002 | - | | 2.5841 | 6300 | 0.0001 | - | | 2.6046 | 6350 | 0.0002 | - | | 2.6251 | 6400 | 0.0006 | - | | 2.6456 | 6450 | 0.0065 | - | | 2.6661 | 6500 | 0.0311 | - | | 2.6866 | 6550 | 0.0143 | - | | 2.7071 | 6600 | 0.0002 | - | | 2.7276 | 6650 | 0.0002 | - | | 2.7482 | 6700 | 0.0007 | - | | 2.7687 | 6750 | 0.0004 | - | | 2.7892 | 6800 | 0.0003 | - | | 2.8097 | 6850 | 0.0004 | - | | 2.8302 | 6900 | 0.0001 | - | | 2.8507 | 6950 | 0.0001 | - | | 2.8712 | 7000 | 0.0001 | - | | 2.8917 | 7050 | 0.0002 | - | | 2.9122 | 7100 | 0.0001 | - | | 2.9327 | 7150 | 0.0001 | - | | 2.9532 | 7200 | 0.0001 | - | | 2.9737 | 7250 | 0.0002 | - | | 2.9943 | 7300 | 0.0001 | - | | 3.0 | 7314 | - | 0.0958 | * The bold row denotes the saved checkpoint. ### Framework Versions - Python: 3.10.4 - SetFit: 1.0.1 - Sentence Transformers: 2.2.2 - Transformers: 4.36.2 - PyTorch: 1.13.0+cpu - Datasets: 2.16.0 - Tokenizers: 0.15.0 ## 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} } ```