Downloads · 30 days
8
1% of all-time downloads
MrEzzat/arabic-eou-detector
arabic-eou-detector is a machine learning model from MrEzzat. 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 apache-2.0.
Detect when a speaker has finished their utterance in Arabic conversations.
Downloads · 30 days
8
1% of all-time downloads
All-time downloads
924
Public
Parameters
135M
1.2 GB on disk
Likes
2
Public
Click a slice to open those files.
.onnx677 MB · 55%
From the Hugging Face model README
Detect when a speaker has finished their utterance in Arabic conversations.
This model is fine-tuned from AraBERT v2 for binary classification of Arabic text to determine if an utterance is complete (EOU) or incomplete (No EOU).
| Metric | Value |
|---|---|
| Accuracy | 90% |
| Precision (EOU) | 0.90 |
| Recall (EOU) | 0.93 |
| F1-Score (EOU) | 0.92 |
| Test Samples | 1,001 |
Predicted
No EOU EOU
Actual No 333 62 (84.3% correct)
EOU 42 564 (93.1% correct)
This repository includes three model formats:
pytorch_model.bin or model.safetensors) - For training and fine-tuningmodel.onnx) - For optimized CPU/GPU inference (~2-3x faster)model_quantized.onnx) - For production (75% smaller, 2-3x faster)pip install transformers torch onnxruntime
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "your-username/arabic-eou-detector"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Inference
def predict_eou(text: str):
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.softmax(logits, dim=-1)
is_eou = torch.argmax(probs, dim=-1).item() == 1
confidence = probs[0, 1].item()
return is_eou, confidence
# Test
text = "مرحبا كيف حالك"
is_eou, conf = predict_eou(text)
print(f"Is EOU: {is_eou}, Confidence: {conf:.4f}")
import onnxruntime as ort
import numpy as np
from transformers import AutoTokenizer
# Load model and tokenizer
model_name = "your-username/arabic-eou-detector"
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Load ONNX model (use model_quantized.onnx for best performance)
session = ort.InferenceSession(
"model_quantized.onnx", # or "model.onnx"
providers=['CPUExecutionProvider']
)
# Inference
def predict_eou(text: str):
inputs = tokenizer(
text,
padding="max_length",
max_length=512,
truncation=True,
return_tensors="np"
)
outputs = session.run(
None,
{
'input_ids': inputs['input_ids'].astype(np.int64),
'attention_mask': inputs['attention_mask'].astype(np.int64)
}
)
logits = outputs[0]
probs = np.exp(logits) / np.sum(np.exp(logits), axis=-1, keepdims=True)
is_eou = np.argmax(probs, axis=-1)[0] == 1
confidence = float(probs[0, 1])
return is_eou, confidence
# Test
text = "مرحبا كيف حالك"
is_eou, conf = predict_eou(text)
print(f"Is EOU: {is_eou}, Confidence: {conf:.4f}")
from livekit.plugins.arabic_turn_detector import ArabicTurnDetector
# Download model from HuggingFace
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(
repo_id="your-username/arabic-eou-detector",
filename="model_quantized.onnx"
)
# Create turn detector
turn_detector = ArabicTurnDetector(
model_path=model_path,
unlikely_threshold=0.7
)
# Use in agent
session = AgentSession(
turn_detector=turn_detector,
# ... other config
)
0: Incomplete utterance (No EOU)1: Complete utterance (EOU)If you use this model, please cite:
@misc{arabic-eou-detector,
author = {Your Name},
title = {Arabic End-of-Utterance Detector},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/your-username/arabic-eou-detector}}
}
Apache 2.0
For issues or questions, please open an issue on the GitHub repository.