Downloads · 30 days
6
25% of all-time downloads
AnnNaserNabil/BaseModelBanglaBert
BaseModelBanglaBert is a machine learning model from AnnNaserNabil. 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.
This model is fine-tuned for binary hate speech detection in Bangla text.
Downloads · 30 days
6
25% of all-time downloads
All-time downloads
24
Public
Parameters
164M
658 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors658 MB · 99%
From the Hugging Face model README
This model is fine-tuned for binary hate speech detection in Bangla text.
Add your metrics here after training
from transformers import AutoModel, AutoTokenizer
import torch
import torch.nn as nn
import json
# Load model components
encoder = AutoModel.from_pretrained("path/to/model")
with open("path/to/model/classifier_config.json", 'r') as f:
c_config = json.load(f)
classifier = nn.Sequential(
nn.Linear(c_config['hidden_size'], 256),
nn.ReLU(),
nn.Dropout(0.1),
nn.Linear(256, c_config['num_labels'])
)
classifier.load_state_dict(torch.load("path/to/model/classifier.pt"))
tokenizer = AutoTokenizer.from_pretrained("path/to/model")
# Predict
def predict(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
outputs = encoder(**inputs)
cls_embedding = outputs.last_hidden_state[:, 0, :]
logits = classifier(cls_embedding)
prob = torch.sigmoid(logits).item()
return prob
text = "আপনার বাংলা টেক্সট এখানে"
prob = predict(text)
print(f"Hate Speech Probability: {prob:.4f}")
If you use this model, please cite:
@misc{bangla-hate-speech-model,
author = {Nabil},
title = {Bangla Hate Speech Detection Model},
year = {2026},
publisher = {HuggingFace},
}
MIT License