█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

Detoxify

पहले से ट्रेन किए गए transformer models से text में toxicity, insults, threats और hate speech का स्कोर निकालें

Guardrails & Securityओपन सोर्स
भाषा
Python
$pip install detoxify
संक्षेप में

Detoxify क्या है?

Detoxify पहले से ट्रेन किए गए transformer models से text में toxicity, insults, threats और hate speech का स्कोर निकालें. यह Evaluation & Production Ops टूल्स की Guardrails & Security श्रेणी में आता है; ओपन सोर्स है और Python में लिखा गया है। शुरू करने के लिए: detoxify इंस्टॉल करें.

सारांश

Detoxify Unitary की ओर से बनी एक ओपन सोर्स Python library है जो text को toxicity के लिए वर्गीकृत करती है। यह pretrained transformer models (जो Hugging Face Transformers और PyTorch Lightning पर बने हैं) को एक आसान इंटरफ़ेस में लपेटती है, जो toxicity, insults, threats, obscenity और identity attacks जैसी श्रेणियों के लिए स्कोर लौटाते हैं।

यह Jigsaw competition datasets पर ट्रेन किए गए तीन मुख्य model variants के साथ आती है: `original` (Toxic Comment Classification), `unbiased` (पहचान से जुड़े उल्लेखों के प्रति अनचाहे bias को कम करने के लिए ट्रेन किया गया), और `multilingual` (English, French, Spanish, Italian, Portuguese, Turkish और Russian को कवर करता है)। छोटे Albert-based variants (`original-small`, `unbiased-small`) भी उपलब्ध हैं।

यह guardrails और content-moderation के क्षेत्र में फिट बैठता है: टीमें इसका इस्तेमाल हानिकारक user content को चिह्नित करने या LLM-powered apps के inputs और outputs की जाँच के लिए करती हैं। लेखकों के अनुसार ये models research के लिए और human moderators की मदद के लिए बने हैं, न कि अकेले automated judge के रूप में।

यह क्या करता है

  • Pretrained models जो text को कई श्रेणियों पर स्कोर करते हैं, जिनमें toxicity, insults, threats, obscenity और identity attacks शामिल हैं
  • तीन model families: `original`, `unbiased` (पहचान से जुड़ा bias कम), और `multilingual` (7 भाषाएँ)
  • हल्के `original-small` और `unbiased-small` Albert-based variants, छोटे footprint के लिए
  • सरल `predict()` API, जो एक string या strings की list स्वीकार करता है
  • डिफ़ॉल्ट रूप से CPU पर चलता है, और किसी भी torch.device इनपुट के ज़रिए GPU को निशाना बनाने के लिए वैकल्पिक `device` argument है
  • Hugging Face Transformers और PyTorch Lightning पर बना है

शुरू करें

PyPI से package इंस्टॉल करें, फिर एक model लोड करें और अपने text पर predict() कॉल करें।

Detoxify इंस्टॉल करें

इंस्टॉल करने के लिए pip कमांड का इस्तेमाल करें।

bashbash
pip install detoxify

कुछ text स्कोर करें

नाम से एक model लोड करें और predict() को एक string या strings की list पास करें। हर model श्रेणी-स्कोर का एक dictionary लौटाता है।

pythonpython
from detoxify import Detoxify

# each model takes in either a string or a list of strings
results = Detoxify('original').predict('example text')

results = Detoxify('unbiased').predict(['example text 1', 'example text 2'])

Device चुनें (वैकल्पिक)

मॉडल डिफ़ॉल्ट रूप से CPU पर चलते हैं। मॉडल को किसी और device पर चलाने के लिए device आर्गुमेंट पास करें; इसमें कोई भी torch.device इनपुट दिया जा सकता है।

pythonpython
model = Detoxify('original', device='cuda')

नतीजे table में दिखाएँ (वैकल्पिक)

हर श्रेणी का स्कोर पढ़ने योग्य frame में प्रिंट करने के लिए pandas इंस्टॉल करें।

pythonpython
import pandas as pd
print(pd.DataFrame(results, index=input_text).round(5))

कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।

कब इस्तेमाल करें

  • उपयोगकर्ताओं के toxic, abusive या hateful comments को चिह्नित करना, ताकि human moderators उन्हें तेज़ी से देख सकें
  • LLM-powered applications के inputs और outputs को हानिकारक content के लिए जाँचना
  • 7 भाषाओं में user content का स्कोर करना, जिन्हें multilingual model सपोर्ट करता है
  • toxicity detection और bias पर research, या किसी domain-specific dataset पर fine-tuning

How Detoxify compares

Detoxify alongside other open-source guardrails & security tools AI/TLDR tracks, ranked by GitHub stars.

टूलस्टारयह क्या करता है
SkillSpector★ 28.6kइंस्टॉल करने से पहले कोई agent skill दुर्भावनापूर्ण पैटर्न के लिए स्कैन करें
Presidio★ 12.2kटेक्स्ट, इमेज और स्ट्रक्चर्ड डेटा में PII की पहचान करें और उसे हटाएं
Failproof AI★ 10.5kएक policy API, जो Claude Code, Codex, Cursor और नौ अन्य agent harnesses से जुड़कर हर event पर agent को block, warn या steer करता है
Guardrails AI★ 7.7kPython में कंपोज़ेबल गार्ड्स से LLM के इनपुट और आउटपुट वैलिडेट करें
NeMo Guardrails★ 7.6kLLM चैट ऐप्स में programmable rails जोड़ें, ताकि वे सुरक्षित रहें और विषय पर बनी रहें
BLA (Blind LLM Agents)★ 7.5kआपके रिलीज़ किए गए build को इतना मज़बूत बनाएं कि AI reverse-engineering agents का बजट खत्म हो जाए और वे नकली चीज़ों के पीछे भागें
dcg (Destructive Command Guard)★ 6.4kएक Rust pre-tool hook जो coding agent के चलाने से पहले destructive shell और git commands को ब्लॉक करता है
Detoxify★ 1.3kपहले से ट्रेन किए गए transformer models से text में toxicity, insults, threats और hate speech का स्कोर निकालें