Skip to content
项目

关于

Arabic to English machine translation with Transformers and Pytorch

人工智能与机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Arabic2English - Arabic to English Translator

This is a PyTorch implementation of an Arabic to English Neural Machine Translation built using Transformers architecture (Attention Is All You Need)

Why Arabic→English is Hard

Arabic is morphologically rich — one word can express what takes a full sentence in English. It's also right-to-left with complex root-based derivation. Standard seq2seq models struggle with this — Transformers handle it better due to attention mechanisms capturing long-range dependencies.

Model Architecture

  • Custom Transformer (Attention Is All You Need)
  • 3 encoder + 3 decoder layers
  • 8 attention heads
  • Embedding size: 256
  • Trained from scratch — no pretrained weights

Setup and Requirements

1. CUDA:
install CUDA before installing the required packages or check if it is already installed

2. Clone the Translate repo:

$ git clone https://github.com/Strifee/arabic2english.git

3. install requirements:

pip install -r requirements.txt

if you have problem with CUDA package try this:

conda install -q pytorch torchvision cudatoolkit=11 -c pytorch-nightly

Data

Arabic to English Translation Sentences :

Arabic to English Translation Sentences is a dataset for machine translation between English and Arabic.

Training

1. Clone the Translate repo:

$ git clone clone https://github.com/Strifee/arabic2english.git

2. Training

$ python translate.py

2. Regularization

Hyperparameters :

BATCH_SIZE = 16
learning_rate = 0.0001
num_epochs = 30

num_heads = 8
num_encoder_layers = 3
num_decoder_layers = 3

max_len= 230
dropout = 0.4
embedding_size= 256

Before regularization :

image

After regularization :

image

Results

"I'm ready" -> 'أنا مستعد'
"i'm lucky"  -> 'انا محظوظ'
"I'm sad" -> 'أنا حزين'

探索相关项目

加载中…