EmanuelOrler's picture
Push model using huggingface_hub.
f98897c verified
metadata
library_name: setfit
metrics:
  - accuracy
pipeline_tag: text-classification
tags:
  - setfit
  - sentence-transformers
  - text-classification
  - generated_from_setfit_trainer
widget:
  - text: >-
      Lewis Hamilton pide perdón tras ser acusado de sexista por burlarse de su
      sobrino
  - text: >-
      Nuevas revelaciones del FIFA Gate: una cuenta ultra secreta y el temor
      reverencial a Julio Grondona
  - text: Hallaron una inmensa `huella digital` en el espacio
  - text: >-
      Qué hacía Gastón Pauls viendo a la Selección con Lionel Messi y Sergio
      Agüero
  - text: >-
      Bitcoin: la volatilidad de las últimas semanas abre el debate sobre el
      futuro de la moneda
inference: true

SetFit

This is a SetFit model that can be used for Text Classification. A LogisticRegression 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 with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

  • Model Type: SetFit
  • Classification head: a LogisticRegression instance
  • Maximum Sequence Length: 512 tokens
  • Number of Classes: 2 classes

Model Sources

Model Labels

Label Examples
Evento
  • 'El dólar vuelve a subir a la espera de una decisión clave del Banco Central'
  • 'Viernes caluroso y sin lluvias'
  • 'ARA San Juan
Perspectiva
  • 'El futuro de la educación tras la pandemia: ¿hacia un modelo híbrido permanente?'
  • '¿Cómo impacta la automatización en los trabajos de baja calificación?'
  • 'Feminicidios: Falta una construcción social y cultural contra la violencia'

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("EmanuelOrler/setfit-spanish-event-perspective")
# Run inference
preds = model("Hallaron una inmensa `huella digital` en el espacio")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 5 12.9231 24
Label Training Sample Count
Evento 22
Perspectiva 17

Training Hyperparameters

  • batch_size: (12, 12)
  • num_epochs: (4, 16)
  • max_steps: -1
  • sampling_strategy: undersampling
  • 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
  • evaluation_strategy: steps
  • eval_max_steps: -1
  • load_best_model_at_end: True

Training Results

Epoch Step Training Loss Validation Loss
0.0159 1 0.0885 -
0.1587 10 0.3927 0.2944
0.3175 20 0.3039 0.2387
0.4762 30 0.2466 0.1807
0.6349 40 0.2049 0.1686
0.7937 50 0.1803 0.1786
0.9524 60 0.1319 0.2002
1.1111 70 0.045 0.3103
1.2698 80 0.0099 0.3200
1.4286 90 0.0036 0.3845
1.5873 100 0.0021 0.4078
1.7460 110 0.0011 0.4184
1.9048 120 0.0011 0.4186
2.0635 130 0.0009 0.4282
2.2222 140 0.0008 0.4242
2.3810 150 0.0008 0.4269
2.5397 160 0.0007 0.4303
2.6984 170 0.0006 0.4301
2.8571 180 0.0006 0.4321
3.0159 190 0.0006 0.4311
3.1746 200 0.0005 0.4291
3.3333 210 0.0006 0.4322
3.4921 220 0.0005 0.4315
3.6508 230 0.0005 0.4308
3.8095 240 0.0005 0.4307
3.9683 250 0.0004 0.4312

Framework Versions

  • Python: 3.10.14
  • SetFit: 1.1.0
  • Sentence Transformers: 3.2.1
  • Transformers: 4.44.0
  • PyTorch: 2.4.0
  • Datasets: 2.21.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}
}