# Enhanced English-to-Tamazight Neural Machine Translation
A character-level Seq2Seq neural machine translation model for translating English to Tamazight (Berber/Amazigh) with both Latin and Tifinagh script support.
## Overview
This project implements an enhanced neural machine translation system specifically designed for the low-resource English→Tamazight language pair. The model achieves competitive performance (targeting BLEU 12-18+) through several advanced techniques including attention mechanisms, learning rate scheduling, and beam search decoding.
## Features
### Core Capabilities
- **Bidirectional Translation Support**: Translates English text to Tamazight
- **Dual Script Output**: Generates translations in both Latin script and Tifinagh (ⵜⵉⴼⵉⵏⴰⵖ)
- **Character-Level Architecture**: Handles morphologically rich Tamazight effectively
- **Low-Resource Optimizations**: Specialized techniques for limited training data
### Advanced Enhancements
- **Attention Mechanism**: Improves translation quality for longer sequences
- **Cosine Learning Rate Scheduling**: Includes warmup period for stable training
- **Validation Split & Early Stopping**: Prevents overfitting on limited data
- **Beam Search Decoding**: Explores multiple translation possibilities for better quality
- **Automatic Model Checkpointing**: Saves the best performing model during training
## Installation
### Prerequisites
- Python 3.8+
- PyTorch 1.9+
- CUDA (optional, for GPU acceleration)
### Required Packages
```bash
pip install torch torchvision torchaudio
pip install datasets
pip install numpy
```
### Optional (for evaluation)
```bash
pip install sacrebleu # For BLEU score calculation
pip install huggingface-hub # For dataset authentication
```
## Dataset
The model trains on two Hugging Face datasets:
1. **Weblate-Translations** (`Tamazight-NLP/Weblate-Translations`)
- No authentication required
- Software localization translations
2. **Beni-Mellal-Tamazight** (`Tamazight-NLP/Beni- …