A lightweight Arabic dialect identification model that classifies input text into one of
11 Arabic dialect / language codes. It is used as the routing backbone in the
Lahgtna pipeline to automatically select the correct voice reference and Chatterbox language token for speech synthesis.
Dialect-aware TTS routing — given an Arabic utterance, predict the dialect so the correct speaker reference audio and Chatterbox language code can be selected automatically.
Standalone Arabic dialect identification for NLP pipelines, content filtering, dataset analysis, or any application that needs to distinguish Arabic dialects programmatically.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_id = "oddadmix/dialect-router-v0.1"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForSequenceClassification.from_pretrained(model_id)
8model.eval()
9
10text = "اه ياراسي الواحد دماغه وجعاه"
11
12inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
13with torch.no_grad():
14 logits = model(**inputs).logits
15
16pred_id = torch.argmax(logits, dim=-1).item()
17dialect = model.config.id2label[pred_id]
18print(dialect) # e.g. "eg"
1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="oddadmix/dialect-router-v0.1",
6)
7result = classifier("اه ياراسي الواحد دماغه وجعاه")
8print(result)
9# [{'label': 'eg', 'score': 0.94}]
1from inference import run_pipeline
2
3# Dialect is detected automatically
4run_pipeline(
5 text="اه ياراسي الواحد دماغه وجعاه",
6 output_path="output.wav",
7)
1@misc{lahgtna-dialect-router-2025,
2 title = {dialect-router-v0.1: Arabic Dialect Identification for TTS Routing},
3 author = {Oddadmix},
4 year = {2025},
5 url = {https://huggingface.co/oddadmix/dialect-router-v0.1}
6}