A lightweight Arabic dialect identification model that classifies input text into one of 15 language codes: 13 Arabic dialects, Modern Standard Arabic, and English. It is the routing backbone in the Lahgtna pipeline, automatically selecting the correct voice reference and Chatterbox language token for speech synthesis.
v0.2 is a fine-tune of
asafaya/bert-mini-arabic and expands coverage from 10 to 13 Arabic dialects, and adds an English label.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_id = "oddadmix/dialect-router-v0.2"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForSequenceClassification.from_pretrained(model_id)
7model.eval()
8
9text = "اه ياراسي الواحد دماغه وجعاه"
10inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
11with torch.no_grad():
12 logits = model(**inputs).logits
13
14pred_id = torch.argmax(logits, dim=-1).item()
15dialect = model.config.id2label[pred_id]
16print(dialect) # e.g. "eg"
1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="oddadmix/dialect-router-v0.2",
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-2026,
2 title = {dialect-router-v0.2: Arabic Dialect Identification for TTS Routing},
3 author = {Oddadmix},
4 year = {2026},
5 url = {https://huggingface.co/oddadmix/dialect-router-v0.2}
6}