Text Classification
Transformers
Safetensors
English
distilbert
multi-label
toxic-comments
text-embeddings-inference
Instructions to use JD1714/ToxicityClassifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JD1714/ToxicityClassifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="JD1714/ToxicityClassifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("JD1714/ToxicityClassifier") model = AutoModelForSequenceClassification.from_pretrained("JD1714/ToxicityClassifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -45,8 +45,39 @@ Puedes probar este clasificador directamente en Python utilizando la librería `
|
|
| 45 |
from transformers import pipeline
|
| 46 |
|
| 47 |
# Cargar el modelo desde el Hub
|
| 48 |
-
clasificador = pipeline("text-classification", model="JD1714/
|
| 49 |
|
| 50 |
# Probar con un texto
|
| 51 |
resultado = clasificador("I hate you, you are a complete idiot!")
|
| 52 |
-
print(resultado)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
from transformers import pipeline
|
| 46 |
|
| 47 |
# Cargar el modelo desde el Hub
|
| 48 |
+
clasificador = pipeline("text-classification", model="JD1714/ToxicityClassifier", top_k=None)
|
| 49 |
|
| 50 |
# Probar con un texto
|
| 51 |
resultado = clasificador("I hate you, you are a complete idiot!")
|
| 52 |
+
print(resultado)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Trainig Details
|
| 56 |
+
|
| 57 |
+
### Training Data
|
| 58 |
+
10.000 ejemplos curados extraídos del Jigsaw Toxic Comment Classification Challenge (80% entrenamiento, 10% validación, 10% prueba).
|
| 59 |
+
|
| 60 |
+
### Training Procedure
|
| 61 |
+
* Estrategia: Fine-tuning completo (se descongelaron todas las capas del backbone).
|
| 62 |
+
|
| 63 |
+
* Manejo del Desbalance: Se utilizó la función de pérdida BCEWithLogitsLoss aplicando pesos por clase (pos_weight) para penalizar severamente los errores en las categorías minoritarias.
|
| 64 |
+
|
| 65 |
+
### Training Hyperparameters
|
| 66 |
+
* Learning rate: 2e-05
|
| 67 |
+
|
| 68 |
+
* Epochs: 6
|
| 69 |
+
|
| 70 |
+
* Batch size: 16
|
| 71 |
+
|
| 72 |
+
* Early Stopping: Patience of 2 epochs (monitoreando F1-Macro)
|
| 73 |
+
|
| 74 |
+
## Evaluation
|
| 75 |
+
### Metrics
|
| 76 |
+
Se utilizó la métrica F1-Macro para medir el rendimiento de forma justa, dándole la misma importancia a todas las clases sin importar su escasez en el dataset.
|
| 77 |
+
|
| 78 |
+
#### Results
|
| 79 |
+
* F1-Macro (Validation): 0.5291
|
| 80 |
+
|
| 81 |
+
* F1-Macro (Test): 0.6175
|
| 82 |
+
|
| 83 |
+
* Training Time: 425 segundos en entorno Google Colab GPU.
|