Downloads · 30 days
14
3% of all-time downloads
zephrox/banglabert-sentence-router-onnx
banglabert-sentence-router-onnx is a text classification model from zephrox. Use it when you need a label for a piece of text. The card lists the license as mit.
This is an ONNX-optimized, binary sentence classification model designed to detect complex Bengali sentences that are difficult for dyslexic readers (ages 6–14). It was created for Shohoj Lipi (সহজ লিপি), a project fo…
Downloads · 30 days
14
3% of all-time downloads
All-time downloads
465
Public
Repo size
55.2 MB
Likes
1
Public
Click a slice to open those files.
.onnx55.2 MB · 97%
From the Hugging Face model README
This is an ONNX-optimized, binary sentence classification model designed to detect complex Bengali sentences that are difficult for dyslexic readers (ages 6–14). It was created for Shohoj Lipi (সহজ লিপি), a project for the SciBlitz AI Challenge 2026 (Track C).
csebuetnlp/banglabert (Electra architecture)0 = Simple, 1 = Complex)BengaliReadability datasetThis model acts as a "Router" in a text simplification pipeline. It rapidly scans Bengali sentences and flags the complex ones (Label 1) to be sent to a Large Language Model (like Gemini) for simplification and syllable-scaffolding, while allowing simple sentences (Label 0) to pass through untouched.
Exporting BanglaBERT to ONNX reduces CPU inference time from ~2.0 seconds to ~300ms and cuts RAM usage by over 60%, allowing it to run smoothly on free-tier hosting services (like Render or Railway) without needing a GPU.
You can load this model locally using onnxruntime and HuggingFace's tokenizers:
import numpy as np
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSequenceClassification
# Load tokenizer and ONNX model
tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/banglabert-sentence-router-onnx")
model = ORTModelForSequenceClassification.from_pretrained("YOUR_USERNAME/banglabert-sentence-router-onnx")
text = "বাংলাদেশের অর্থনীতি মূলত কৃষিনির্ভর।"
inputs = tokenizer(text, return_tensors="pt")
# Inference
outputs = model(**inputs)
logits = outputs.logits.detach().numpy()
predicted_class = np.argmax(logits, axis=1)[0]
confidence = np.max(np.exp(logits) / np.sum(np.exp(logits), axis=1, keepdims=True))
print("Class:", "Complex" if predicted_class == 1 else "Simple")
print("Confidence:", confidence)