If you've tried running an off-the-shelf English toxicity classifier on Hindi social media text, you've probably watched it fall apart on sentences like "yaar tum kitne pagal ho" — not because the model is bad, but because it was never shown Hinglish (code-mixed Hindi-English) during training. Word order shifts, scripts mix mid-sentence, and English tokenizers choke on Devanagari.
This tutorial walks through fine-tuning bert-base-multilingual-cased (mBERT) as a toxicity classifier on Hinglish text, end to end: loading data, tokenizing, building the model, training, and evaluating. No GPU required — everything here runs on CPU in about 15-20 minutes.
What you'll need
Python 3.8+
torch, transformers, scikit-learn, tqdm







