Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 🧠 MarianMT-Text-Translation-AI-Model-"en-de"
|
2 |
+
|
3 |
+
A sequence-to-sequence translation model fine-tuned on English–German sentence pairs. This model translates English text into German and is built using the Hugging Face MarianMTModel. It’s suitable for general-purpose translation, language learning, and formal or semi-formal communication across English and German.
|
4 |
+
|
5 |
+
---
|
6 |
+
|
7 |
+
## ✨ Model Highlights
|
8 |
+
|
9 |
+
- 📌 Base Model: Helsinki-NLP/opus-mt-en-de
|
10 |
+
- 📚 Fine-tuned on a cleaned and tokenized parallel English-German dataset
|
11 |
+
- 🌍 Direction: English → German
|
12 |
+
- 🔧 Framework: Hugging Face Transformers + PyTorch
|
13 |
+
|
14 |
+
---
|
15 |
+
|
16 |
+
## 🧠 Intended Uses
|
17 |
+
|
18 |
+
- ✅ Translating English content (emails, documentation, support text) into German
|
19 |
+
- ✅ Use in educational platforms for learning German
|
20 |
+
- ✅ Supporting cross-lingual customer service, product documentation, or semi-formal communications
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
## 🚫 Limitations
|
25 |
+
|
26 |
+
- ❌ Not optimized for informal, idiomatic, or slang expressions
|
27 |
+
- ❌ Not ideal for legal, medical, or sensitive content translation
|
28 |
+
- 📏 Sentences longer than 128 tokens are truncated
|
29 |
+
- ⚠️ Domain-specific accuracy may vary (e.g., legal, technical)
|
30 |
+
|
31 |
+
---
|
32 |
+
|
33 |
+
## 🏋️♂️ Training Details
|
34 |
+
|
35 |
+
| Attribute | Value |
|
36 |
+
|--------------------|----------------------------------|
|
37 |
+
| Base Model | `Helsinki-NLP/opus-mt-en-de` |
|
38 |
+
| Dataset | WMT14 English-German |
|
39 |
+
| Task Type | Translation |
|
40 |
+
| Max Token Length | 128 |
|
41 |
+
| Epochs | 3 |
|
42 |
+
| Batch Size | 16 |
|
43 |
+
| Optimizer | AdamW |
|
44 |
+
| Loss Function | CrossEntropyLoss |
|
45 |
+
| Framework | PyTorch + Transformers |
|
46 |
+
| Hardware | CUDA-enabled GPU |
|
47 |
+
|
48 |
+
---
|
49 |
+
|
50 |
+
## 📊 Evaluation Metrics
|
51 |
+
|
52 |
+
| Metric | Score |
|
53 |
+
|------------|---------|
|
54 |
+
| BLEU Score | 30.42 |
|
55 |
+
|
56 |
+
---
|
57 |
+
|
58 |
+
## 🔎 Output Details
|
59 |
+
|
60 |
+
- Input: English text string
|
61 |
+
- Output: Translated German text string
|
62 |
+
|
63 |
+
---
|
64 |
+
|
65 |
+
## 🚀 Usage
|
66 |
+
|
67 |
+
```python
|
68 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
69 |
+
import torch
|
70 |
+
|
71 |
+
model_name = "AventIQ-AI/Ai-Translate-Model-Eng-German"
|
72 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
73 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
74 |
+
model.eval()
|
75 |
+
|
76 |
+
def translate(text):
|
77 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
78 |
+
model.to(device)
|
79 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True).to(device)
|
80 |
+
outputs = model.generate(**inputs)
|
81 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
82 |
+
|
83 |
+
# Example
|
84 |
+
print(translate("How are you doing today?"))
|
85 |
+
|
86 |
+
```
|
87 |
+
---
|
88 |
+
|
89 |
+
## 📁 Repository Structure
|
90 |
+
```
|
91 |
+
finetuned-model/
|
92 |
+
├── config.json ✅ Model architecture & config
|
93 |
+
├── pytorch_model.bin ✅ Model weights
|
94 |
+
├── tokenizer_config.json ✅ Tokenizer settings
|
95 |
+
├── tokenizer.json ✅ Tokenizer vocabulary (JSON format)
|
96 |
+
├── source.spm ✅ SentencePiece model for source language
|
97 |
+
├── target.spm ✅ SentencePiece model for target language
|
98 |
+
├── special_tokens_map.json ✅ Special tokens mapping
|
99 |
+
├── generation_config.json ✅ (Optional) Generation defaults
|
100 |
+
├── README.md ✅ Model card
|
101 |
+
|
102 |
+
```
|
103 |
+
|
104 |
+
## 🤝 Contributing
|
105 |
+
Contributions are welcome! Feel free to open an issue or pull request to improve the model, training scripts, or documentation.
|
106 |
+
|
107 |
+
|
108 |
+
|