Downloads · 30 days
11
28% of all-time downloads
tamim65/banglabert-hate-speech-prod-v3
banglabert-hate-speech-prod-v3 is a machine learning model from tamim65. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Production V3 multi-label hate speech detection model for Bangla text.
Downloads · 30 days
11
28% of all-time downloads
All-time downloads
40
Public
Parameters
110M
965 MB on disk
Likes
0
Public
Click a slice to open those files.
.pt525 MB · 54%
From the Hugging Face model README
Production V3 multi-label hate speech detection model for Bangla text.
import torch
from transformers import AutoTokenizer
import pickle
# Load model and tokenizer
model_path = "tamim65/banglabert-hate-speech-prod-v3"
tokenizer = AutoTokenizer.from_pretrained(model_path)
# Load full model (custom architecture)
model = torch.load(f"{model_path}/full_model.pt", map_location='cpu')
model.eval()
# Load metadata and thresholds
with open(f"{model_path}/metadata.pkl", 'rb') as f:
metadata = pickle.load(f)
with open(f"{model_path}/optimal_thresholds.pkl", 'rb') as f:
optimal_thresholds = pickle.load(f)
# Predict
def predict(text):
inputs = tokenizer(text, return_tensors='pt', padding=True, truncation=True, max_length=128)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.sigmoid(outputs).cpu().numpy()[0]
# Apply thresholds
predictions = {}
for i, label in enumerate(metadata['label_names']):
predictions[label] = {
'probability': float(probs[i]),
'predicted': bool(probs[i] >= optimal_thresholds[i])
}
return predictions
# Example
text = "আপনার মন্তব্য খুব সুন্দর"
result = predict(text)
print(result)
full_model.pt: Complete model with custom architecturemodel.safetensors: Model weights (safetensors format)config.json: Model configurationtokenizer.json, vocab.txt: Tokenizer filesmetadata.pkl: Label names and metadataoptimal_thresholds.pkl: Per-label threshold valuesIf you use this model, please cite:
@misc{banglabert-hate-speech-v3,
author = {Tamim},
title = {BanglaBERT Hate Speech Detection - Production V3},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/tamim65/banglabert-hate-speech-prod-v3}}
}
MIT License