Text Classification
Transformers
Safetensors
Hindi
English
bert
hinglish
code-mixed
research
hate-speech-detection
text-embeddings-inference
Instructions to use OmTheLast/mbert-hinglish-thar with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OmTheLast/mbert-hinglish-thar with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="OmTheLast/mbert-hinglish-thar")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("OmTheLast/mbert-hinglish-thar") model = AutoModelForSequenceClassification.from_pretrained("OmTheLast/mbert-hinglish-thar", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Clarify research overview, results and reproducibility details
Browse files
README.md
CHANGED
|
@@ -11,48 +11,34 @@ tags:
|
|
| 11 |
- research
|
| 12 |
- hate-speech-detection
|
| 13 |
---
|
| 14 |
-
#
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
- Class 1: `ANTI_RELIGION`
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
- [CM source repository](https://github.com/shikharras/cm-hate-speech-detection) — Hindi-English political/social Twitter/X offensive-language data, 3,900 processed rows.
|
| 31 |
-
- [THAR source repository](https://github.com/aakash-dl/THAR) and [paper](https://doi.org/10.1145/3653017) — religious hate in Hindi-English YouTube comments, 11,549 rows.
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
See `training_metadata.json` for this run's settings, row counts, split policy and any reconstructed fields. Runs used two training epochs; the script restores the epoch with the highest evaluation Macro F1. The exported weights may therefore come from an earlier epoch.
|
| 38 |
-
|
| 39 |
-
Kaggle and THAR use stratified 80/20 splits whose membership changes with the seed. Variation includes split changes as well as training randomness.
|
| 40 |
-
|
| 41 |
-
**Evaluation limitation:** the training script evaluates each epoch on this evaluation split and uses it to choose the checkpoint. In CM this includes the source test split. The following scores are therefore selection-set results, not an untouched final test estimate. The training seed was supplied to Trainer; exact reproduction of classifier initialization and device behavior is not guaranteed.
|
| 42 |
-
|
| 43 |
-
### Internal / matched evaluation recorded with checkpoints
|
| 44 |
-
|
| 45 |
-
| Seed | Accuracy | Macro F1 | Positive F1 | Positive recall |
|
| 46 |
-
|---:|---:|---:|---:|---:|
|
| 47 |
-
| 7 | 0.7463 | 0.7463 | 0.7454 | 0.7864 |
|
| 48 |
-
| 13 | 0.7459 | 0.7457 | 0.7518 | 0.8148 |
|
| 49 |
-
| 42 | 0.7481 | 0.7480 | 0.7445 | 0.7773 |
|
| 50 |
-
|
| 51 |
-
Across seeds 7, 13, 42: Macro F1 **0.7467 ± 0.0012** (sample standard deviation, not a confidence interval). This describes the group, not one checkpoint.
|
| 52 |
-
|
| 53 |
-
All scores above come directly from the saved `eval_metrics.json` files. Historical `*_hate` keys mean the dataset-specific positive class. The 79-row diagnostic probe is excluded from these claims.
|
| 54 |
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
Install packages from `requirements.txt`. This repository is public and can be loaded without a Hugging Face login.
|
| 58 |
|
|
@@ -82,15 +68,36 @@ print({model.config.id2label[i]: float(score) for i, score in enumerate(scores)}
|
|
| 82 |
|
| 83 |
Preprocessing preserves case, replaces URLs with `URL`, handles with `USER`, and collapses whitespace. Truncation is 128 tokens including special tokens.
|
| 84 |
|
| 85 |
-
|
| 86 |
|
| 87 |
-
|
|
|
|
| 88 |
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
Public research checkpoint release. Both base-model cards declare Apache-2.0 ([mBERT](https://huggingface.co/google-bert/bert-base-multilingual-cased), [MuRIL](https://huggingface.co/google/muril-base-cased)). A license for these fine-tuned releases has not yet been assigned: training-source terms remain under review, including the unresolved CM and THAR licenses. The base-model license is not a license grant for the datasets. Public access does not assign a new license to the fine-tuned releases or their training data. The upstream Apache-2.0 license is included in `BASE_MODEL_LICENSE.txt`; see `BASE_MODEL_NOTICE.md` for attribution.
|
| 92 |
|
| 93 |
-
## Reproducibility and project
|
| 94 |
|
| 95 |
- [Research code](https://github.com/OmTheLast/mBERT-vs-MuRIL-cross-dataset-hinglish-hate), source snapshot `4650c6eb093d422785284656dd6765d36e438522`.
|
| 96 |
- [Working paper draft](https://github.com/OmTheLast/mBERT-vs-MuRIL-cross-dataset-hinglish-hate/blob/4650c6eb093d422785284656dd6765d36e438522/paper/application_research_draft.md).
|
|
@@ -102,3 +109,6 @@ Public research checkpoint release. Both base-model cards declare Apache-2.0 ([m
|
|
| 102 |
### Tools Note
|
| 103 |
|
| 104 |
AI tools were used for coding, debugging, and documentation assistance; the research direction, result interpretation, and final claims were reviewed and owned by Om Patnaik.
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- research
|
| 12 |
- hate-speech-detection
|
| 13 |
---
|
| 14 |
+
# mBERT: THAR targeted religious hate
|
| 15 |
|
| 16 |
+
mBERT fine-tuned for binary classification of Hindi–English code-mixed text on **THAR targeted religious hate**. Part of a comparative study of dataset transfer, training mixtures and seed variation.
|
| 17 |
|
| 18 |
+
[Research code](https://github.com/OmTheLast/mBERT-vs-MuRIL-cross-dataset-hinglish-hate) · [Results](https://github.com/OmTheLast/mBERT-vs-MuRIL-cross-dataset-hinglish-hate/blob/main/docs/matched_multiseed_results.md)
|
| 19 |
|
| 20 |
+
- **Labels:** `0 = NON_ANTI_RELIGION`, `1 = ANTI_RELIGION`.
|
| 21 |
+
- **Revision:** seed 42; `main` defaults to seed 42. Available: `seed-7`, `seed-13`, `seed-42`.
|
| 22 |
+
- **Training sources:** [THAR](https://github.com/aakash-dl/THAR). No dataset text is included.
|
| 23 |
|
| 24 |
+
## Evaluation
|
|
|
|
| 25 |
|
| 26 |
+
Evaluation splits also guided checkpoint selection; the recorded internal scores are not untouched final-test estimates. Cross-dataset results and label definitions should be interpreted separately.
|
| 27 |
|
| 28 |
+
| Seed | Macro F1 | Positive recall |
|
| 29 |
+
|---:|---:|---:|
|
| 30 |
+
| 7 | 0.7463 | 0.7864 |
|
| 31 |
+
| 13 | 0.7457 | 0.8148 |
|
| 32 |
+
| 42 | 0.7480 | 0.7773 |
|
| 33 |
|
| 34 |
+
Mean Macro F1: **0.7467 ± 0.0012** (sample standard deviation).
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
## Limitations
|
| 37 |
|
| 38 |
+
Use for research, comparison and error analysis. Cross-dataset generalization is limited; label definitions and platforms differ, duplicates exist in CM, and annotation/source uncertainties remain. Identity words, transliteration, quoted abuse and missing conversation context can cause errors. These checkpoints have not been validated for autonomous moderation or decisions about individuals. Single-seed mixed results do not establish seed robustness.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
<details>
|
| 41 |
+
<summary>Loading and preprocessing</summary>
|
| 42 |
|
| 43 |
Install packages from `requirements.txt`. This repository is public and can be loaded without a Hugging Face login.
|
| 44 |
|
|
|
|
| 68 |
|
| 69 |
Preprocessing preserves case, replaces URLs with `URL`, handles with `USER`, and collapses whitespace. Truncation is 128 tokens including special tokens.
|
| 70 |
|
| 71 |
+
</details>
|
| 72 |
|
| 73 |
+
<details>
|
| 74 |
+
<summary>Training details and full evaluation</summary>
|
| 75 |
|
| 76 |
+
See `training_metadata.json` for this run's settings, row counts, split policy and any reconstructed fields. Runs used two training epochs; the script restores the epoch with the highest evaluation Macro F1. The exported weights may therefore come from an earlier epoch.
|
| 77 |
+
|
| 78 |
+
Kaggle and THAR use stratified 80/20 splits whose membership changes with the seed. Variation includes split changes as well as training randomness.
|
| 79 |
+
|
| 80 |
+
**Evaluation limitation:** the training script evaluates each epoch on this evaluation split and uses it to choose the checkpoint. In CM this includes the source test split. The following scores are therefore selection-set results, not an untouched final test estimate. The training seed was supplied to Trainer; exact reproduction of classifier initialization and device behavior is not guaranteed.
|
| 81 |
+
|
| 82 |
+
### Internal / matched evaluation recorded with checkpoints
|
| 83 |
+
|
| 84 |
+
| Seed | Accuracy | Macro F1 | Positive F1 | Positive recall |
|
| 85 |
+
|---:|---:|---:|---:|---:|
|
| 86 |
+
| 7 | 0.7463 | 0.7463 | 0.7454 | 0.7864 |
|
| 87 |
+
| 13 | 0.7459 | 0.7457 | 0.7518 | 0.8148 |
|
| 88 |
+
| 42 | 0.7481 | 0.7480 | 0.7445 | 0.7773 |
|
| 89 |
+
|
| 90 |
+
Across seeds 7, 13, 42: Macro F1 **0.7467 ± 0.0012** (sample standard deviation, not a confidence interval). This describes the group, not one checkpoint.
|
| 91 |
+
|
| 92 |
+
All scores above come directly from the saved `eval_metrics.json` files. Historical `*_hate` keys mean the dataset-specific positive class. The 79-row diagnostic probe is excluded from these claims.
|
| 93 |
+
|
| 94 |
+
</details>
|
| 95 |
+
|
| 96 |
+
<details>
|
| 97 |
+
<summary>Licensing and provenance</summary>
|
| 98 |
|
| 99 |
Public research checkpoint release. Both base-model cards declare Apache-2.0 ([mBERT](https://huggingface.co/google-bert/bert-base-multilingual-cased), [MuRIL](https://huggingface.co/google/muril-base-cased)). A license for these fine-tuned releases has not yet been assigned: training-source terms remain under review, including the unresolved CM and THAR licenses. The base-model license is not a license grant for the datasets. Public access does not assign a new license to the fine-tuned releases or their training data. The upstream Apache-2.0 license is included in `BASE_MODEL_LICENSE.txt`; see `BASE_MODEL_NOTICE.md` for attribution.
|
| 100 |
|
|
|
|
| 101 |
|
| 102 |
- [Research code](https://github.com/OmTheLast/mBERT-vs-MuRIL-cross-dataset-hinglish-hate), source snapshot `4650c6eb093d422785284656dd6765d36e438522`.
|
| 103 |
- [Working paper draft](https://github.com/OmTheLast/mBERT-vs-MuRIL-cross-dataset-hinglish-hate/blob/4650c6eb093d422785284656dd6765d36e438522/paper/application_research_draft.md).
|
|
|
|
| 109 |
### Tools Note
|
| 110 |
|
| 111 |
AI tools were used for coding, debugging, and documentation assistance; the research direction, result interpretation, and final claims were reviewed and owned by Om Patnaik.
|
| 112 |
+
|
| 113 |
+
</details>
|
| 114 |
+
|