mBART-50 English → Darja
A fine-tuned version of facebook/mbart-large-50
that translates English into Darja (Algerian Arabic dialect), written in Arabic script.
Model details
| Base model | facebook/mbart-large-50 (~610M parameters) |
| Task | English → Darja machine translation |
| Source language token | en_XX |
| Target language token | ar_AR (see note below) |
| Training data | asce3/darja-english |
Note on the target language code. mBART-50 has no language code for Darja, so the standard Arabic token
ar_ARis used as a proxy. The model has been fine-tuned to produce Darja, but the token itself does not mean Darja.
Usage
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
repo = "asce3/mbart50-english-darja"
tokenizer = AutoTokenizer.from_pretrained(repo, src_lang="en_XX", tgt_lang="ar_AR")
model = AutoModelForSeq2SeqLM.from_pretrained(repo)
texts = ["I don't know", "Where are you going?"]
batch = tokenizer(texts, return_tensors="pt", padding=True)
outputs = model.generate(**batch, max_length=64, num_beams=4)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
Example outputs:
| English | Darja |
|---|---|
| I don't know | منعرف |
| Where are you going? | وين رايحين؟ |
The forced start token (ar_AR) is stored in the model's generation config, so
generate() needs no extra arguments.
Training
- Data: a random sample of about 150,000 sentence pairs from the dataset (about 4 million pairs remained after removing empty rows and duplicate English sentences). 2,000 pairs were held out for validation.
- Epochs: 1 (about 9,400 optimizer steps)
- Effective batch size: 16 (1 per GPU × 8 gradient-accumulation steps × 2 GPUs)
- Learning rate: 2e-5 with a short warmup and linear decay
- Optimizer: Adafactor
- Precision: fp16 mixed precision, gradient checkpointing
- Max length: 96 tokens (source and target)
- Frozen parameters: the shared embedding / output projection
- Hardware: 2 × NVIDIA Tesla T4 (Kaggle), distributed data parallel
Intended use
Research and experimentation with English-to-Darja translation, and as a starting point for further fine-tuning.
Limitations
- The model saw only a small part of the available data for a single epoch, so it is under-trained. Expect errors, especially on long or rare sentences.
- No formal evaluation (such as BLEU or chrF) has been run yet. The two examples above are illustrative, not a benchmark.
- Darja varies a lot by region, and written Darja has no standard spelling. Output follows the conventions of the training data, which may not match every region or writing style.
- Outputs can reflect biases and errors in the training data. Do not use the model for high-stakes translation without human review.
- Input is limited to about 96 tokens. Longer text should be split into sentences.
Acknowledgements
- Base model: mBART-50 by Facebook AI
- Dataset:
asce3/darja-english