Text Classification
Transformers
Safetensors
Spanish
bert
hate-speech
toxicity
spanish
el-salvador
mbert
Eval Results (legacy)
text-embeddings-inference
Instructions to use caeher/mbert-sv with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use caeher/mbert-sv with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="caeher/mbert-sv")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("caeher/mbert-sv") model = AutoModelForSequenceClassification.from_pretrained("caeher/mbert-sv", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| language: | |
| - es | |
| license: apache-2.0 | |
| base_model: google-bert/bert-base-multilingual-cased | |
| tags: | |
| - text-classification | |
| - hate-speech | |
| - toxicity | |
| - spanish | |
| - el-salvador | |
| - mbert | |
| pipeline_tag: text-classification | |
| library_name: transformers | |
| metrics: | |
| - f1 | |
| - accuracy | |
| model-index: | |
| - name: mbert-sv | |
| results: | |
| - task: | |
| type: text-classification | |
| name: Toxicidad en español salvadoreño | |
| dataset: | |
| name: Corpus tesina (test, n=460) | |
| type: custom | |
| metrics: | |
| - type: f1 | |
| value: 0.7777 | |
| name: F1-macro | |
| - type: accuracy | |
| value: 0.7826 | |
| name: Accuracy | |
| # mBERT-SV — Clasificación de toxicidad (El Salvador) | |
| Fine-tuning de [`bert-base-multilingual-cased`](https://huggingface.co/google-bert/bert-base-multilingual-cased) para clasificación **multiclase** de toxicidad en redes sociales en español salvadoreño. | |
| Checkpoint de auditoría: **`checkpoint-1072`** (época 4, semilla 42). | |
| ## Etiquetas | |
| | id | etiqueta | | |
| |----|----------| | |
| | 0 | No Tóxico | | |
| | 1 | Lenguaje Ofensivo | | |
| | 2 | Discurso de Odio | | |
| | 3 | Amenazas/Violencia | | |
| ## Contrato de inferencia | |
| | Campo | Valor | | |
| |-------|-------| | |
| | `max_length` | 128 | | |
| | Columna de texto | `texto_modelo` | | |
| | Normalizador | `normalize_for_model` v1.1 | | |
| Si el texto no está preprocesado, hay que aplicar el mismo normalizador del repositorio de la tesina. | |
| ## Métricas oficiales (test, n = 460) | |
| | Métrica | Valor | | |
| |---------|-------| | |
| | F1-macro | **0.7777** | | |
| | Accuracy | 0.7826 | | |
| | Precision-macro | 0.7809 | | |
| | Recall-macro | 0.7757 | | |
| | QWK | 0.7362 | | |
| F1 por clase: No Tóxico 0.814 · Lenguaje Ofensivo 0.795 · Discurso de Odio 0.746 · Amenazas/Violencia 0.756. | |
| ## Uso | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
| import torch | |
| repo_id = "caeher/mbert-sv" | |
| tokenizer = AutoTokenizer.from_pretrained(repo_id) | |
| model = AutoModelForSequenceClassification.from_pretrained(repo_id) | |
| text = "ejemplo de comentario" | |
| inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128) | |
| with torch.no_grad(): | |
| logits = model(**inputs).logits | |
| pred = int(logits.argmax(dim=-1)) | |
| print(model.config.id2label[pred]) | |
| ``` | |
| ## Archivos | |
| - `model.safetensors`, `config.json`, `tokenizer.json`, `tokenizer_config.json` | |
| - `inference_contract.json` — contrato de preprocesamiento | |
| - `test_metrics.json` / `train_metrics.json` — métricas del checkpoint | |
| ## Limitaciones | |
| Modelo de tesina, no un moderador autónomo. El corpus es de El Salvador; el desempeño puede caer en otros dialectos o en jerga adversarial. FPR sobre jerga no tóxica y cortes por plataforma están documentados en el informe del proyecto. | |