YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
BART-base fine-tuned on ParaDetox (text detoxification)
Rewrites a toxic English comment into a polite one that keeps its meaning, e.g. "The referee was a complete idiot and ruined the damn game." โ "The referee ruined the game."
- Base model:
facebook/bart-base - Dataset: ParaDetox (19.7k toxic โ neutral pairs). The data ships as a single split; we built an 80/10/10 split grouped by toxic comment so no comment appears in both train and test.
- Training: lr 1e-4, batch size 16, 4 epochs, fp16; the best validation checkpoint (epoch 1) is kept. Beam search (4 beams) at inference.
Test results (1,193 unique toxic comments, all references)
BLEU and chrF are multi-reference (sacreBLEU). STA is the % of outputs that
s-nlp/roberta_toxicity_classifier labels as non-toxic.
| System | BLEU | chrF | STA |
|---|---|---|---|
| Copy the input (baseline) | 54.2 | 76.6 | 0.0% |
| Delete words from a toxic lexicon (baseline) | 63.4 | 79.3 | 85.8% |
| Human rewrite (reference) | - | - | 94.3% |
| This model | 66.4 | 80.4 | 86.9% |
These numbers use our own test split, so they are not directly comparable with the ParaDetox paper.
Usage
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("jeffespejo/bart-base-paradetox-udea")
model = AutoModelForSeq2SeqLM.from_pretrained("jeffespejo/bart-base-paradetox-udea")
inputs = tokenizer("Shut up and stop wasting everyone's time with your stupid questions.", return_tensors="pt")
print(tokenizer.decode(model.generate(**inputs, num_beams=4, max_length=128)[0], skip_special_tokens=True))
Limitations
The model mostly removes or softens offensive words; implicit toxicity and sarcasm are not handled well, and the meaning can shift slightly. Built as a university course project (Fundamentos de Procesamiento de Lenguaje Natural ยท Universidad de Antioquia) by Jefferson Espejo. Code: https://github.com/AndiEspejo/emotions-skills-detox-nlp
- Downloads last month
- 56
Model tree for jeffespejo/bart-base-paradetox-udea
Base model
facebook/bart-base