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
|
| 8 |
+
- marian
|
| 9 |
+
- nmt
|
| 10 |
+
- encoder-decoder
|
| 11 |
+
- from-scratch
|
| 12 |
+
pipeline_tag: translation
|
| 13 |
+
widget:
|
| 14 |
+
- text: "The weather is beautiful today."
|
| 15 |
+
example_title: "Simple sentence"
|
| 16 |
+
- text: "Machine learning is transforming the way we build software applications."
|
| 17 |
+
example_title: "Technical text"
|
| 18 |
+
- text: "The European Union has proposed new regulations on artificial intelligence."
|
| 19 |
+
example_title: "Formal text"
|
| 20 |
+
datasets:
|
| 21 |
+
- opus100
|
| 22 |
+
- europarl_bilingual
|
| 23 |
+
- un_pc
|
| 24 |
+
model-index:
|
| 25 |
+
- name: pumatic-en-pl
|
| 26 |
+
results: []
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# Pumatic English-Polish Translation Model
|
| 30 |
+
|
| 31 |
+
A neural machine translation model for English to Polish translation, **trained entirely from scratch** using the MarianMT architecture.
|
| 32 |
+
|
| 33 |
+
## Model Description
|
| 34 |
+
|
| 35 |
+
- **Model type:** Encoder-Decoder (MarianMT architecture)
|
| 36 |
+
- **Language pair:** English → Polish
|
| 37 |
+
- **Parameters:** ~74.4M
|
| 38 |
+
- **Training approach:** From scratch (randomly initialized weights, custom tokenizer)
|
| 39 |
+
- **GPU:** 4x NVIDIA H200
|
| 40 |
+
- **Trained by:** [pumad](https://huggingface.co/pumad)
|
| 41 |
+
|
| 42 |
+
> **Note:** This model was **not fine-tuned** from any existing pre-trained model. Both the model weights and the SentencePiece tokenizer were trained from scratch on the parallel corpus.
|
| 43 |
+
|
| 44 |
+
## Architecture
|
| 45 |
+
|
| 46 |
+
| Component | Configuration |
|
| 47 |
+
|-----------|---------------|
|
| 48 |
+
| d_model | 768 |
|
| 49 |
+
| Encoder layers | 8 |
|
| 50 |
+
| Decoder layers | 8 |
|
| 51 |
+
| Attention heads | 12 |
|
| 52 |
+
| FFN dimension | 3072 |
|
| 53 |
+
| Vocabulary size | 32,000 |
|
| 54 |
+
| Max position embeddings | 512 |
|
| 55 |
+
| Activation function | GELU |
|
| 56 |
+
|
| 57 |
+
## Training Details
|
| 58 |
+
|
| 59 |
+
### Training Data
|
| 60 |
+
|
| 61 |
+
The model was trained on high-quality parallel corpora:
|
| 62 |
+
- **OPUS-100** - Multilingual parallel corpus
|
| 63 |
+
- **Europarl** - European Parliament proceedings
|
| 64 |
+
- **UN Parallel Corpus (UNPC)** - United Nations documents
|
| 65 |
+
|
| 66 |
+
### Training Procedure
|
| 67 |
+
|
| 68 |
+
- **Hardware:** 4x NVIDIA H200 GPU (distributed training)
|
| 69 |
+
- **Framework:** Hugging Face Transformers + Accelerate
|
| 70 |
+
- **Batch size:** 512 per GPU (2048 effective)
|
| 71 |
+
- **Learning rate:** 3e-4 with cosine decay
|
| 72 |
+
- **Warmup:** 6% of training steps
|
| 73 |
+
- **Epochs:** 10
|
| 74 |
+
- **Optimizer:** Fused AdamW
|
| 75 |
+
- **Precision:** bf16 mixed precision
|
| 76 |
+
- **Max sequence length:** 128 tokens
|
| 77 |
+
|
| 78 |
+
### Tokenizer
|
| 79 |
+
|
| 80 |
+
A custom SentencePiece tokenizer (unigram model) was trained on the parallel corpus with:
|
| 81 |
+
- 32,000 vocabulary size
|
| 82 |
+
- 99.95% character coverage
|
| 83 |
+
- Language tag support (`>>pl<<`)
|
| 84 |
+
|
| 85 |
+
### Data Preprocessing
|
| 86 |
+
|
| 87 |
+
- Quality filtering: Removed pairs with fewer than 5 words or more than 200 words
|
| 88 |
+
- Length ratio filtering: Excluded pairs with extreme length ratios (< 0.5 or > 2.0)
|
| 89 |
+
- Deduplication: Removed duplicate source sentences
|
| 90 |
+
|
| 91 |
+
## Usage
|
| 92 |
+
|
| 93 |
+
### Using the Transformers library
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
from transformers import MarianMTModel, MarianTokenizer
|
| 97 |
+
|
| 98 |
+
model_name = "pumad/pumatic-en-pl"
|
| 99 |
+
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
| 100 |
+
model = MarianMTModel.from_pretrained(model_name)
|
| 101 |
+
|
| 102 |
+
text = "Hello, how are you today?"
|
| 103 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True)
|
| 104 |
+
translated = model.generate(**inputs)
|
| 105 |
+
output = tokenizer.decode(translated[0], skip_special_tokens=True)
|
| 106 |
+
print(output)
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
### Using the Pipeline API
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
from transformers import pipeline
|
| 113 |
+
|
| 114 |
+
translator = pipeline("translation", model="pumad/pumatic-en-pl")
|
| 115 |
+
result = translator("The quick brown fox jumps over the lazy dog.")
|
| 116 |
+
print(result[0]['translation_text'])
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
## Demo
|
| 120 |
+
|
| 121 |
+
Try this model live at [pumatic.eu](https://pumatic.eu)
|
| 122 |
+
|
| 123 |
+
API documentation available at [pumatic.eu/docs](https://pumatic.eu/docs)
|
| 124 |
+
|
| 125 |
+
## Limitations
|
| 126 |
+
|
| 127 |
+
- Optimized for general-purpose translation; domain-specific terminology may vary in quality
|
| 128 |
+
- Maximum input length of ~400 characters per chunk for optimal results
|
| 129 |
+
- Best performance on formal/written text; colloquial expressions may be less accurate
|
| 130 |
+
|
| 131 |
+
## License
|
| 132 |
+
|
| 133 |
+
Apache 2.0
|
| 134 |
+
|
| 135 |
+
## Citation
|
| 136 |
+
|
| 137 |
+
If you use this model, please cite:
|
| 138 |
+
|
| 139 |
+
```bibtex
|
| 140 |
+
@misc{pumatic-en-pl,
|
| 141 |
+
author = {pumad},
|
| 142 |
+
title = {Pumatic English-Polish Translation Model},
|
| 143 |
+
year = {2025},
|
| 144 |
+
publisher = {Hugging Face},
|
| 145 |
+
url = {https://huggingface.co/pumad/pumatic-en-pl}
|
| 146 |
+
}
|
| 147 |
+
```
|