skillfed

detoxify

A python library for detecting toxic comments

detoxify v0.5.2 110.5K downloads/30d#12,457 on PyPI1,289
Permissive license Active released

What it is and what it does

Detoxify is a Python library that wraps pre-trained transformer models to classify text comments for toxic content. It provides three model variants—original, unbiased, and multilingual—each trained on Jigsaw challenge datasets to detect different types of toxicity including threats, obscenity, insults, and identity-based attacks. The models return confidence scores for each toxicity category, allowing developers to programmatically flag harmful content.

The package is built on transformers and PyTorch Lightning, with low installation friction via a pure Python wheel. It's designed for research and content moderation workflows rather than as a production-grade system; the documentation explicitly acknowledges limitations around bias (e.g., flagging swearing regardless of intent) and recommends fine-tuning on carefully constructed datasets for real-world deployment. The multilingual model supports seven languages with documented per-language performance metrics.

Use it for:

  • Flag potentially harmful user comments in forums or social platforms for human review by moderators.
  • Rank or filter comments in a dataset by toxicity score to prioritize moderation efforts.
  • Build a content safety pipeline that rejects or quarantines submissions exceeding a toxicity threshold.
  • Analyze multilingual comment datasets across seven languages to identify toxic patterns by region or language.
  • Fine-tune the pre-trained models on domain-specific comment data (e.g., gaming, healthcare) to improve detection accuracy.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Detoxify classifies text comments for toxic content using pre-trained transformer models, returning confidence scores across categories like toxicity, obscenity, threats, and identity-based attacks.

Yes, if you need to add toxicity classification to a Python application or research pipeline. The package is actively maintained, has no known vulnerabilities, and offers permissive licensing. However, treat it as a research tool or first-pass filter rather than a production content moderation system—the documentation warns of bias limitations and recommends careful validation and fine-tuning before deployment in high-stakes scenarios.

Install

detoxify on PyPI

pip

pip install detoxify

uv

uv add detoxify

poetry

poetry add detoxify

Installing detoxify

Before you install

Low friction install with a pure Python wheel. The package is actively maintained with a recent commit on 2026-07-06 and has been in active development since 2020-11-09, suggesting stable ongoing support.

License in practice

Licensed under Apache Software License (permissive), meaning you can use, modify, and distribute the package freely with minimal restrictions, making it suitable for both commercial and research applications.

Quickstart

pip install detoxify

from detoxify import Detoxify

results = Detoxify('original').predict('example text')
results = Detoxify('multilingual').predict(['example text', 'ejemplo de texto'])

Requires transformers, torch, and sentencepiece as runtime dependencies; torch installation may require system-level setup depending on your platform (CPU vs GPU).

Verify before relying

  • Whether the multilingual model covers languages beyond the documented seven (English, French, Spanish, Italian, Portuguese, Turkish, Russian).
  • Performance characteristics and latency for batch inference on large comment volumes.
  • How model predictions handle edge cases like sarcasm, code-switching, or domain-specific terminology.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 3 — transformers, torch, sentencepiece
Maintenance actively maintained — 925 days since the last release
Last repo commit
First released
Downloads 110,480/month — #12,457 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: detoxify-0.5.2-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

toxic comment detectiontoxicity classificationhate speech detectioncontent moderationmultilingual toxicityoffensive language detectioncomment toxicity scoring
content-moderationnlptransformer-models

More Artificial Intelligence packages

Further reading