Downloads · 30 days
6
6% of all-time downloads
Abdelrahman2922/arabic-english-transformer
arabic-english-transformer is a translation model from Abdelrahman2922. Use it when you need text moved from one language to another. The card lists the license as mit.
A complete implementation of the Transformer architecture from scratch for Arabic-to-English machine translation, built with PyTorch.
Downloads · 30 days
6
6% of all-time downloads
All-time downloads
97
Public
Repo size
1.7 GB
Likes
0
Public
Click a slice to open those files.
.pt1.7 GB · 100%
From the Hugging Face model README
A complete implementation of the Transformer architecture from scratch for Arabic-to-English machine translation, built with PyTorch.
📖 Full Project Article: Building a Transformer from Scratch for Arabic-English Translation
This model is a sequence-to-sequence Transformer that translates Arabic text to English. It implements every component of the original "Attention Is All You Need" paper, including:
The model was trained on the OPUS-100 Arabic-English parallel corpus, which contains approximately 1 million sentence pairs.
import torch
from src.inference import load_model_and_tokenizers, translate_sentence
from src.config import get_config
# Load model
cfg = get_config()
device = torch.device("cpu")
model, tokenizer_src, tokenizer_trg = load_model_and_tokenizers(cfg, device)
# Translate
arabic_text = "مرحبا بالعالم"
english_translation = translate_sentence(
model, tokenizer_src, tokenizer_trg, arabic_text, cfg, device
)
print(english_translation) # "Hello world"
python main.py
python app.py
After 3 epochs of training:
| Metric | Greedy Decoding | Beam Search (k=3) |
|---|---|---|
| BLEU | 0.225 | 0.237 |
| WER | 0.694 | 0.701 |
| CER | 0.509 | 0.516 |
@misc{arabic-english-transformer,
title={Arabic-English Translation Transformer},
author={Abdelrahman Mohamed},
year={2025},
url={https://github.com/Veto2922/transformer-arabic-english-translation}
}
This model is licensed under the MIT License.