--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: Plasta - text: 203 terminada - text: habitación 294 limpia - text: ¡Hola, cómo va todo! - text: Quiero ver el estado de la incidencia que reporté en la Calle Mayor de Triana. metrics: - accuracy pipeline_tag: text-classification library_name: setfit inference: true base_model: jaimevera1107/all-MiniLM-L6-v2-similarity-es --- # Input Classifier This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [jaimevera1107/all-MiniLM-L6-v2-similarity-es](https://huggingface.co/jaimevera1107/all-MiniLM-L6-v2-similarity-es) 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:** [jaimevera1107/all-MiniLM-L6-v2-similarity-es](https://huggingface.co/jaimevera1107/all-MiniLM-L6-v2-similarity-es) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 256 tokens - **Number of Classes:** 4 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 | |:-------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------| | request | | | conversation | | | help | | | censorship | | ## 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("monentiadev/es-input-classifier") # Run inference preds = model("Hola") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 1 | 5.0723 | 38 | | Label | Training Sample Count | |:-------------|:----------------------| | censorship | 407 | | conversation | 137 | | help | 274 | | request | 552 | ### Training Hyperparameters - batch_size: (128, 128) - num_epochs: (3, 3) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 20 - 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 - l2_weight: 0.01 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0023 | 1 | 0.3161 | - | | 0.1166 | 50 | 0.2857 | - | | 0.2331 | 100 | 0.2158 | - | | 0.3497 | 150 | 0.1581 | - | | 0.4662 | 200 | 0.0878 | - | | 0.5828 | 250 | 0.0299 | - | | 0.6993 | 300 | 0.0124 | - | | 0.8159 | 350 | 0.0083 | - | | 0.9324 | 400 | 0.006 | - | | 1.0490 | 450 | 0.0038 | - | | 1.1655 | 500 | 0.0027 | - | | 1.2821 | 550 | 0.0027 | - | | 1.3986 | 600 | 0.0017 | - | | 1.5152 | 650 | 0.0016 | - | | 1.6317 | 700 | 0.0013 | - | | 1.7483 | 750 | 0.0012 | - | | 1.8648 | 800 | 0.0012 | - | | 1.9814 | 850 | 0.001 | - | | 2.0979 | 900 | 0.001 | - | | 2.2145 | 950 | 0.0011 | - | | 2.3310 | 1000 | 0.0009 | - | | 2.4476 | 1050 | 0.0008 | - | | 2.5641 | 1100 | 0.0009 | - | | 2.6807 | 1150 | 0.0008 | - | | 2.7972 | 1200 | 0.0008 | - | | 2.9138 | 1250 | 0.0007 | - | ### Framework Versions - Python: 3.10.0 - SetFit: 1.1.2 - Sentence Transformers: 5.0.0 - Transformers: 4.53.1 - PyTorch: 2.7.1+cu126 - Datasets: 2.19.2 - Tokenizers: 0.21.2