Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## π§ English to Spanish Translation AI Model
|
| 2 |
+
|
| 3 |
+
This repository contains a Transformer-based AI model fine-tuned for English to Spanish text translation. The model has been trained, quantized (FP16), and tested for quality and scoring. It delivers high-accuracy translations and is suitable for real-world use cases such as educational tools, real-time communication, and travel assistants.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## π Features
|
| 8 |
+
|
| 9 |
+
- π **Language Pair**: English β Spanish
|
| 10 |
+
- π§ **Model**: Helsinki-NLP/opus-mt-en-es
|
| 11 |
+
- π§ͺ **Quantized**: FP16 for efficient inference
|
| 12 |
+
- π― **High Accuracy**: Scored well on validation sets
|
| 13 |
+
- β‘ **CUDA Enabled**: Fast training and inference
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## π Dataset Used
|
| 18 |
+
|
| 19 |
+
**Hugging Face Dataset**: **OscarNav/spa-eng**
|
| 20 |
+
|
| 21 |
+
- Source: OscarNav
|
| 22 |
+
- Language Pair: `en-es`
|
| 23 |
+
- Dataset Size: ~107K sentence pairs
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
from datasets import load_dataset
|
| 27 |
+
|
| 28 |
+
dataset = load_dataset("OscarNav/spa-eng", lang1="en", lang2="es")
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## π οΈ Model Training & Fine-Tuning
|
| 32 |
+
|
| 33 |
+
- Pretrained Base Model: Helsinki-NLP/opus-mt-en-es
|
| 34 |
+
|
| 35 |
+
- Tokenizer: AutoTokenizer from Hugging Face Transformers
|
| 36 |
+
|
| 37 |
+
- Training Environment: Kaggle Notebook with CUDA GPU
|
| 38 |
+
|
| 39 |
+
- Batch Size: 16
|
| 40 |
+
|
| 41 |
+
- Epochs: 3β5 (based on early stopping)
|
| 42 |
+
|
| 43 |
+
- Optimizer: AdamW
|
| 44 |
+
|
| 45 |
+
- Loss Function: CrossEntropyLoss
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
## π§ͺ Quantization (FP16)
|
| 49 |
+
|
| 50 |
+
Quantized the model for reduced memory usage and faster inference without compromising translation quality.
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
model = model.half()
|
| 54 |
+
model.save_pretrained("quantized_model_fp16")
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## β
Scoring
|
| 58 |
+
BLEU Score: ~34+
|
| 59 |
+
|
| 60 |
+
- Evaluation Metric: sacrebleu on validation set
|
| 61 |
+
|
| 62 |
+
- Inference Accuracy: Verified using real-world sample sentences
|