SuperSl6/saudi-eou-dataset
Viewer • Updated • 7.15k • 6
How to use MohamedSalamaYasen/saudi_eou_model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="MohamedSalamaYasen/saudi_eou_model") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("MohamedSalamaYasen/saudi_eou_model")
model = AutoModelForSequenceClassification.from_pretrained("MohamedSalamaYasen/saudi_eou_model", device_map="auto")Fine-tuned BERT model for detecting End-of-Utterance (EOU) in Saudi Arabic conversational text. The model predicts whether a text segment is complete (EOU) or needs continuation.
pip install transformers torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "MohamedSalamaYasen/saudi_eou_model"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Example text
text = "شكرا جزيلا على المساعدة"
# Tokenize
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
# Predict
model.eval()
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
prediction = torch.argmax(probs, dim=1).item()
# Results
labels = {0: "CONTINUATION", 1: "EOU"}
confidence = probs[0][prediction].item()
print(f"Text: {text}")
print(f"Prediction: {labels[prediction]}")
print(f"Confidence: {confidence:.3f}")
Output:
Text: شكرا جزيلا على المساعدة
Prediction: EOU
Confidence: 0.921
from transformers import pipeline
# Create classifier
classifier = pipeline(
"text-classification",
model="MohamedSalamaYasen/saudi_eou_model"
)
# Predict
result = classifier("مرحبا كيف حالك")
print(result)
# Output: [{'label': 'LABEL_1', 'score': 0.876}]
# LABEL_0 = CONTINUATION, LABEL_1 = EOU
texts = [
"مرحبا كيف حالك", # Complete utterance
"أنا بخير والحمد لله", # Complete utterance
"بس المشكلة انه", # Incomplete - needs continuation
"شكرا على وقتك" # Complete utterance
]
results = classifier(texts)
for text, result in zip(texts, results):
label = "EOU" if result['label'] == 'LABEL_1' else "CONTINUATION"
print(f"{text}: {label} ({result['score']:.3f})")
0: NOT_EOU (continuation needed)1: EOU (complete utterance)| Metric | Score |
|---|---|
| Accuracy | 98.7% |
| F1 Score | 0.99 |
| Precision | 0.98 |
| Recall | 1.00 |
@misc{saudi_eou_model_2024,
author = {Mohamed Salama Yasen},
title = {Arabic End-of-Utterance Detection Model for Saudi Dialect},
year = {2024},
publisher = {HuggingFace},
url = {https://huggingface.co/MohamedSalamaYasen/saudi_eou_model}
}
Apache 2.0
Model Version: 1.0
Last Updated: December 2024
Status: Production Ready ✅
Base model
faisalq/SaudiBERT