--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: La falta de entrega de la denuncia en el momento de la infracción, sin causa que lo impida, genera indefensión y la invalida. - text: No es verdad que condujera bajo los efectos del alcohol. No había ingerido ninguna bebida alcohólica, la prueba debió estar mal hecha. - text: Se sanciona sin explicar motivadamente las razones por las que se considera acreditada la comisión de la infracción, pese a lo alegado por el interesado. - text: Reclamo que se practique una reconstrucción de los hechos para demostrar que la colisión se produjo por una maniobra imprudente del otro conductor. - text: La sanción no está suficientemente motivada, pues no se justifica la valoración de la prueba efectuada ni el rechazo de las pruebas propuestas por el interesado. pipeline_tag: text-classification inference: true base_model: desarrolloasesoreslocales/bert-leg-al-corpus model-index: - name: SetFit with desarrolloasesoreslocales/bert-leg-al-corpus results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.8 name: Accuracy --- # SetFit with desarrolloasesoreslocales/bert-leg-al-corpus 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-corpus](https://huggingface.co/desarrolloasesoreslocales/bert-leg-al-corpus) 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-corpus](https://huggingface.co/desarrolloasesoreslocales/bert-leg-al-corpus) - **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:** 15 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 | |:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 49 | | | 269 | | | 2014 | | | 78 | | | 32 | | | 12 | | | 2017 | | | 304 | | | 2027 | | | 357 | | | 2002 | | | 994 | | | 42 | | | 1002 | | | 1001 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.8 | ## 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("La falta de entrega de la denuncia en el momento de la infracción, sin causa que lo impida, genera indefensión y la invalida.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 14 | 22.4 | 37 | | Label | Training Sample Count | |:------|:----------------------| | 12 | 16 | | 32 | 18 | | 42 | 16 | | 49 | 16 | | 78 | 18 | | 269 | 17 | | 304 | 16 | | 357 | 13 | | 994 | 18 | | 1001 | 18 | | 1002 | 18 | | 2002 | 16 | | 2014 | 19 | | 2017 | 17 | | 2027 | 19 | ### Training Hyperparameters - batch_size: (24, 24) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 8 - body_learning_rate: (2e-05, 2e-05) - head_learning_rate: 2e-05 - 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: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0059 | 1 | 0.2923 | - | | 0.2941 | 50 | 0.143 | - | | 0.5882 | 100 | 0.1346 | - | | 0.8824 | 150 | 0.0339 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 2.6.1 - Transformers: 4.38.2 - PyTorch: 2.2.1+cu121 - Datasets: 2.18.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} } ```