--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer base_model: desarrolloasesoreslocales/bert-leg-al-setfit metrics: - accuracy widget: - text: En el momento de la sanción (fecha/02/2020 a las 15:37), el vehículo se encontraba estacionado correctamente junto a la asociación de vecinos (NOMBRE DE LA ASOCIACIÓN) de [NOMBRE DE LA ZONA], según las normas de parada y estacionamiento citadas en los artículos 90, 91, 92, 93 y 94 del Reglamento General de Circulación. Si bien el litoral de [NOMBRE DE LA ZONA] cuenta con señalización que indica la restricción del estacionamiento de Autocaravanas y Caravanas, ésta no especifica la restricción de estacionamiento de furgones o furgonetas. - text: La sanción impuesta carece de motivación adecuada, pues no se justifica la concurrencia de los elementos subjetivos de la infracción apreciada. - text: "Remisión de la prueba fotográfica que pudo y debió tomar el agente denunciante\ \ en el momento de formular la denuncia. \n" - text: Que se proceda a la apertura del periodo de prueba para la denuncia número GHI012, conforme al artículo 13 del Real Decreto 320/1992, y se solicite la ratificación del agente denunciante y la aportación de pruebas documentales y fotográficas. - text: Considero que la sanción impuesta es desproporcionada y no se justifica por la gravedad de la infracción, por lo que solicito su revisión conforme al principio de proporcionalidad. pipeline_tag: text-classification inference: true model-index: - name: SetFit with desarrolloasesoreslocales/bert-leg-al-setfit results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.8947368421052632 name: Accuracy --- # SetFit with desarrolloasesoreslocales/bert-leg-al-setfit This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [desarrolloasesoreslocales/bert-leg-al-setfit](https://huggingface.co/desarrolloasesoreslocales/bert-leg-al-setfit) 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:** [desarrolloasesoreslocales/bert-leg-al-setfit](https://huggingface.co/desarrolloasesoreslocales/bert-leg-al-setfit) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 4096 tokens - **Number of Classes:** 19 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 | |:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1001 | | | 2014 | | | 2038 | | | 2017 | | | 2002 | | | 2026 | | | 2039 | | | 2001 | | | 2010 | | | 304 | | | 2060 | | | 2027 | | | 49 | | | 2037 | | | 353 | | | 994 | | | 357 | | | 78 | | | 2013 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.8947 | ## 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("desarrolloasesoreslocales/bert-leg-al-setfit") # Run inference preds = model("Remisión de la prueba fotográfica que pudo y debió tomar el agente denunciante en el momento de formular la denuncia. ") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 3 | 48.0478 | 335 | | Label | Training Sample Count | |:------|:----------------------| | 49 | 11 | | 78 | 11 | | 304 | 11 | | 353 | 11 | | 357 | 11 | | 994 | 11 | | 1001 | 11 | | 2001 | 11 | | 2002 | 11 | | 2010 | 11 | | 2013 | 11 | | 2014 | 11 | | 2017 | 11 | | 2026 | 11 | | 2027 | 11 | | 2037 | 11 | | 2038 | 11 | | 2039 | 11 | | 2060 | 11 | ### Training Hyperparameters - batch_size: (24, 24) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 50 - body_learning_rate: (3e-05, 3e-05) - head_learning_rate: 3e-05 - loss: CosineSimilarityLoss - distance_metric: cosine_distance - margin: 0.25 - end_to_end: False - use_amp: True - warmup_proportion: 0.1 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0011 | 1 | 0.0216 | - | | 0.0574 | 50 | 0.0069 | - | | 0.1148 | 100 | 0.0031 | - | | 0.1722 | 150 | 0.0134 | - | | 0.2296 | 200 | 0.0018 | - | | 0.2870 | 250 | 0.0073 | - | | 0.3444 | 300 | 0.0011 | - | | 0.4018 | 350 | 0.001 | - | | 0.4592 | 400 | 0.0006 | - | | 0.5166 | 450 | 0.0011 | - | | 0.5741 | 500 | 0.0006 | - | | 0.6315 | 550 | 0.0004 | - | | 0.6889 | 600 | 0.0003 | - | | 0.7463 | 650 | 0.0027 | - | | 0.8037 | 700 | 0.0013 | - | | 0.8611 | 750 | 0.0002 | - | | 0.9185 | 800 | 0.0002 | - | | 0.9759 | 850 | 0.0005 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 3.0.0 - Transformers: 4.39.2 - PyTorch: 2.3.0+cu121 - Datasets: 2.19.1 - 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} } ```