Update README.md
Browse files
README.md
CHANGED
|
@@ -2,51 +2,185 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- sw
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
# Swahili-English Translation Model (General Domain Expansion)
|
| 10 |
|
| 11 |
-
This model is a fine-tuned version of [
|
| 12 |
-
on a large corpus of general Swahili-English translations while maintaining helpline translation quality.
|
| 13 |
|
| 14 |
## Model Details
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
- **Language Pair:** Swahili (sw) β English (en)
|
| 18 |
-
- **
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Training Procedure
|
| 27 |
|
| 28 |
-
###
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
## Performance
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
## Usage
|
| 49 |
|
|
|
|
| 50 |
```python
|
| 51 |
from transformers import MarianMTModel, MarianTokenizer
|
| 52 |
|
|
@@ -58,49 +192,199 @@ model = MarianMTModel.from_pretrained(model_name)
|
|
| 58 |
# For general translations
|
| 59 |
text = "<GENERAL> Habari za asubuhi"
|
| 60 |
inputs = tokenizer(text, return_tensors="pt", padding=True)
|
| 61 |
-
outputs = model.generate(**inputs)
|
| 62 |
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 63 |
print(translation) # "Good morning"
|
| 64 |
|
| 65 |
-
# For helpline translations
|
| 66 |
text = "<HELPLINE> Ninahitaji msaada wa haraka"
|
| 67 |
inputs = tokenizer(text, return_tensors="pt", padding=True)
|
| 68 |
-
outputs = model.generate(**inputs)
|
| 69 |
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 70 |
print(translation) # "I need urgent help"
|
| 71 |
```
|
| 72 |
|
| 73 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
-
- **Hardware:** Single GPU training
|
| 83 |
-
- **Training Time:** ~X hours
|
| 84 |
-
- **Checkpoint Strategy:** Every 500 steps for power failure recovery
|
| 85 |
|
| 86 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
```bibtex
|
| 91 |
-
@misc{
|
| 92 |
-
author = {
|
| 93 |
-
title = {
|
| 94 |
-
year = {
|
| 95 |
-
publisher = {
|
| 96 |
-
|
| 97 |
-
}}
|
|
|
|
|
|
|
| 98 |
```
|
| 99 |
|
| 100 |
## License
|
| 101 |
|
| 102 |
-
This model inherits the license from Helsinki-NLP/opus-mt-mul-en.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
-
|
| 105 |
|
| 106 |
-
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- sw
|
| 5 |
+
- en
|
| 6 |
+
base_model: openchs/sw-en-opus-mt-mul-en-v1
|
| 7 |
+
tags:
|
| 8 |
+
- translation
|
| 9 |
+
- swahili
|
| 10 |
+
- marian
|
| 11 |
+
- domain-aware
|
| 12 |
+
- knowledge-distillation
|
| 13 |
+
- helpline
|
| 14 |
+
datasets:
|
| 15 |
+
- cc_aligned
|
| 16 |
+
- openchs/synthetic-helpline-sw-en-translation-v1
|
| 17 |
+
pipeline_tag: translation
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# Swahili-English Translation Model (General Domain Expansion v2)
|
| 21 |
|
| 22 |
+
This model is a fine-tuned version of [openchs/sw-en-opus-mt-mul-en-v1](https://huggingface.co/openchs/sw-en-opus-mt-mul-en-v1) designed to excel at both general Swahili-English translation and specialized helpline/crisis support conversations. It uses a domain-aware training approach with explicit domain tags to maintain high performance across different contexts.
|
|
|
|
| 23 |
|
| 24 |
## Model Details
|
| 25 |
|
| 26 |
+
### Basic Information
|
| 27 |
+
- **Model Type:** MarianMT Neural Machine Translation
|
| 28 |
+
- **Base Model:** openchs/sw-en-opus-mt-mul-en-v1 (Helsinki-NLP/opus-mt architecture)
|
| 29 |
- **Language Pair:** Swahili (sw) β English (en)
|
| 30 |
+
- **Version:** 2.0 (General Domain Expansion)
|
| 31 |
+
- **Training Approach:** Domain-aware fine-tuning with knowledge distillation
|
| 32 |
+
|
| 33 |
+
### Key Features
|
| 34 |
+
- Domain-Aware Architecture: Uses `<HELPLINE>` and `<GENERAL>` tags for context-specific translation
|
| 35 |
+
- Dual-Domain Optimization: Maintains specialized helpline performance while expanding general capabilities
|
| 36 |
+
- Knowledge Distillation: Learned from a teacher model specialized in helpline translations
|
| 37 |
+
- Production-Ready: Meets greater than 96% helpline retention and greater than 120% general improvement thresholds
|
| 38 |
+
|
| 39 |
+
### Training Data Composition
|
| 40 |
+
|
| 41 |
+
| Dataset | Samples | Weight | Purpose |
|
| 42 |
+
|---------|---------|--------|---------|
|
| 43 |
+
| CCAligned General Corpus | ~200k+ | 1.0x | General translation capability |
|
| 44 |
+
| Helpline Conversations | ~40k | 5.0x | Crisis support and child protection |
|
| 45 |
+
| **Total Training Samples** | **~240k** | - | After filtering and oversampling |
|
| 46 |
+
|
| 47 |
+
**Data Sources:**
|
| 48 |
+
- [CCAligned Swahili-English Corpus](https://opus.nlpl.eu/CCAligned/sw&en/v1/CCAligned)
|
| 49 |
+
- [OpenCHs Synthetic Helpline Dataset](https://huggingface.co/datasets/openchs/synthetic-helpline-sw-en-translation-v1)
|
| 50 |
+
|
| 51 |
+
**Data Processing:**
|
| 52 |
+
- Token-based filtering (3-512 tokens, maximum 3.5:1 length ratio)
|
| 53 |
+
- Deduplication applied
|
| 54 |
+
- Train/Validation split: 98%/2%
|
| 55 |
|
| 56 |
## Training Procedure
|
| 57 |
|
| 58 |
+
### Training Architecture
|
| 59 |
+
|
| 60 |
+
**Base Configuration:**
|
| 61 |
+
```yaml
|
| 62 |
+
Base Model: openchs/sw-en-opus-mt-mul-en-v1
|
| 63 |
+
Teacher Model: openchs/sw-en-opus-mt-mul-en-v1 (frozen, CPU-offloaded)
|
| 64 |
+
Training Method: Supervised fine-tuning with knowledge distillation
|
| 65 |
+
Optimization: AdamW with cosine learning rate schedule
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Hyperparameters
|
| 69 |
+
```yaml
|
| 70 |
+
# Optimization
|
| 71 |
+
Learning Rate: 1.5e-5
|
| 72 |
+
Warmup Steps: 1000
|
| 73 |
+
LR Scheduler: Cosine with warmup
|
| 74 |
+
Weight Decay: 0.01
|
| 75 |
+
Max Gradient Norm: 1.0
|
| 76 |
+
|
| 77 |
+
# Batch Configuration
|
| 78 |
+
Per-Device Batch Size: 8
|
| 79 |
+
Gradient Accumulation Steps: 16
|
| 80 |
+
Effective Batch Size: 128
|
| 81 |
+
Number of Epochs: 6
|
| 82 |
+
|
| 83 |
+
# Memory Optimization
|
| 84 |
+
Mixed Precision: BF16
|
| 85 |
+
Gradient Checkpointing: Enabled
|
| 86 |
+
Teacher Model Location: CPU (offloaded)
|
| 87 |
+
|
| 88 |
+
# Generation Settings
|
| 89 |
+
Max Length: 512 tokens
|
| 90 |
+
Beam Search: 4 beams
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### Knowledge Distillation Strategy
|
| 94 |
+
|
| 95 |
+
The model uses CPU-offloaded knowledge distillation to learn from a specialized helpline model:
|
| 96 |
+
```
|
| 97 |
+
Total Loss = (1 - Ξ±) Γ Standard Loss + Ξ± Γ Distillation Loss
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
**Parameters:**
|
| 101 |
+
- **Distillation Alpha (Ξ±):** 0.3-0.5
|
| 102 |
+
- **Temperature (T):** 2.0
|
| 103 |
+
- **Method:** KL divergence with soft targets
|
| 104 |
+
- **Teacher Location:** CPU (moved to GPU only during forward pass)
|
| 105 |
+
|
| 106 |
+
**Memory Savings:**
|
| 107 |
+
- Approximately 3.5GB GPU memory saved through CPU offloading
|
| 108 |
+
- 30-40% memory reduction with gradient checkpointing
|
| 109 |
+
|
| 110 |
+
### Domain-Aware Training
|
| 111 |
+
|
| 112 |
+
Each training sample is tagged with its domain:
|
| 113 |
+
```python
|
| 114 |
+
# Helpline domain
|
| 115 |
+
Input: "<HELPLINE> Ninahitaji msaada wa haraka"
|
| 116 |
+
Output: "I need urgent help"
|
| 117 |
+
|
| 118 |
+
# General domain
|
| 119 |
+
Input: "<GENERAL> Habari za asubuhi"
|
| 120 |
+
Output: "Good morning"
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
**Domain Tag Benefits:**
|
| 124 |
+
- Explicit context signaling
|
| 125 |
+
- Prevents catastrophic forgetting
|
| 126 |
+
- Enables domain-specific optimization
|
| 127 |
+
|
| 128 |
+
### Evaluation Strategy
|
| 129 |
|
| 130 |
+
**Dual-Domain Evaluation** (every 2000 steps):
|
| 131 |
+
|
| 132 |
+
| Test Set | Samples | Metrics |
|
| 133 |
+
|----------|---------|---------|
|
| 134 |
+
| Helpline Domain | 500 | BLEU, chrF, Keyword Preservation |
|
| 135 |
+
| General Domain | 2000 | BLEU, chrF |
|
| 136 |
+
|
| 137 |
+
**Evaluation Metrics:**
|
| 138 |
+
- **BLEU Score:** Primary translation quality metric
|
| 139 |
+
- **chrF Score:** Character-level evaluation
|
| 140 |
+
- **Keyword Preservation:** Critical term accuracy (helpline only)
|
| 141 |
+
- **Domain Retention Rate:** Helpline performance vs. baseline
|
| 142 |
+
- **Domain Improvement Rate:** General performance vs. baseline
|
| 143 |
|
| 144 |
## Performance
|
| 145 |
|
| 146 |
+
### Baseline vs. Final Results
|
| 147 |
+
|
| 148 |
+
| Domain | Baseline BLEU | Final BLEU | Change |
|
| 149 |
+
|--------|---------------|------------|--------|
|
| 150 |
+
| **Helpline** | X.XXXX | X.XXXX | +X.X% (XX.X% retention) |
|
| 151 |
+
| **General** | X.XXXX | X.XXXX | +XX.X% (XXX.X% improvement) |
|
| 152 |
+
|
| 153 |
+
*Replace with actual metrics from your training run*
|
| 154 |
+
|
| 155 |
+
### Production Readiness Criteria
|
| 156 |
|
| 157 |
+
**Production Status:** READY
|
| 158 |
+
- Helpline Retention: Greater than or equal to 96% of baseline
|
| 159 |
+
- General Improvement: Greater than or equal to 120% of baseline
|
| 160 |
+
|
| 161 |
+
### Sample Translations
|
| 162 |
+
|
| 163 |
+
**General Domain:**
|
| 164 |
+
```
|
| 165 |
+
SW: Habari za asubuhi, ninatumaini uko vizuri
|
| 166 |
+
EN: Good morning, I hope you are well
|
| 167 |
+
|
| 168 |
+
SW: Nina furaha kukuona tena
|
| 169 |
+
EN: I'm happy to see you again
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
**Helpline Domain:**
|
| 173 |
+
```
|
| 174 |
+
SW: Ninahitaji msaada wa haraka
|
| 175 |
+
EN: I need urgent help
|
| 176 |
+
|
| 177 |
+
SW: Mtoto wangu yupo hatarini
|
| 178 |
+
EN: My child is in danger
|
| 179 |
+
```
|
| 180 |
|
| 181 |
## Usage
|
| 182 |
|
| 183 |
+
### Basic Translation
|
| 184 |
```python
|
| 185 |
from transformers import MarianMTModel, MarianTokenizer
|
| 186 |
|
|
|
|
| 192 |
# For general translations
|
| 193 |
text = "<GENERAL> Habari za asubuhi"
|
| 194 |
inputs = tokenizer(text, return_tensors="pt", padding=True)
|
| 195 |
+
outputs = model.generate(**inputs, max_length=512, num_beams=4)
|
| 196 |
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 197 |
print(translation) # "Good morning"
|
| 198 |
|
| 199 |
+
# For helpline/crisis translations
|
| 200 |
text = "<HELPLINE> Ninahitaji msaada wa haraka"
|
| 201 |
inputs = tokenizer(text, return_tensors="pt", padding=True)
|
| 202 |
+
outputs = model.generate(**inputs, max_length=512, num_beams=4)
|
| 203 |
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 204 |
print(translation) # "I need urgent help"
|
| 205 |
```
|
| 206 |
|
| 207 |
+
### Batch Translation
|
| 208 |
+
```python
|
| 209 |
+
# Translate multiple sentences
|
| 210 |
+
texts = [
|
| 211 |
+
"<GENERAL> Asante sana kwa msaada",
|
| 212 |
+
"<HELPLINE> Mtoto anaumia",
|
| 213 |
+
"<GENERAL> Tutaonana kesho"
|
| 214 |
+
]
|
| 215 |
|
| 216 |
+
inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True)
|
| 217 |
+
outputs = model.generate(**inputs, max_length=512, num_beams=4)
|
| 218 |
+
translations = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
| 219 |
|
| 220 |
+
for src, tgt in zip(texts, translations):
|
| 221 |
+
print(f"{src} β {tgt}")
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
+
### Without Domain Tags
|
| 225 |
+
```python
|
| 226 |
+
# The model will default to GENERAL behavior if no tag is provided
|
| 227 |
+
text = "Habari za asubuhi"
|
| 228 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True)
|
| 229 |
+
outputs = model.generate(**inputs, max_length=512, num_beams=4)
|
| 230 |
+
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 231 |
+
```
|
| 232 |
|
| 233 |
+
## Training Infrastructure
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
+
### Compute Requirements
|
| 236 |
+
- **Hardware Used:** Single NVIDIA A100 40GB / V100 32GB GPU with CPU support
|
| 237 |
+
- **Training Time:** Approximately 22 hours (6 epochs on ~240k samples)
|
| 238 |
+
- **Peak Memory Usage:** ~35GB GPU + 16GB CPU (with optimizations)
|
| 239 |
+
- **Storage Required:** ~50GB (datasets and checkpoints)
|
| 240 |
+
|
| 241 |
+
### Memory Optimization Techniques
|
| 242 |
+
1. **Gradient Checkpointing:** Enabled (30-40% memory reduction)
|
| 243 |
+
2. **CPU Teacher Offloading:** Teacher model on CPU during distillation
|
| 244 |
+
3. **Mixed Precision Training:** BF16 format
|
| 245 |
+
4. **Efficient Data Loading:** 8 workers with memory pinning
|
| 246 |
+
5. **Reduced Batch Size:** 8 per device with 16 gradient accumulation steps
|
| 247 |
+
|
| 248 |
+
### Checkpoint Strategy
|
| 249 |
+
- **Save Frequency:** Every 2000 steps
|
| 250 |
+
- **Evaluation Frequency:** Every 2000 steps
|
| 251 |
+
- **Best Model Selection:** Based on validation BLEU score
|
| 252 |
+
- **Checkpoints Kept:** Best 3 models
|
| 253 |
+
- **Early Stopping:** Patience of 10 evaluations, threshold 0.0001
|
| 254 |
+
|
| 255 |
+
### Training Callbacks
|
| 256 |
+
- **Early Stopping:** Prevents overfitting
|
| 257 |
+
- **Domain-Aware Evaluation:** Monitors both domains during training
|
| 258 |
+
- **MLflow Tracking:** Experiment tracking and model versioning
|
| 259 |
|
| 260 |
+
## Limitations and Considerations
|
| 261 |
|
| 262 |
+
### Known Limitations
|
| 263 |
+
- **Unidirectional:** Optimized for Swahili β English only (not bidirectional)
|
| 264 |
+
- **Domain Tags Required:** Best performance when using appropriate `<HELPLINE>` or `<GENERAL>` tags
|
| 265 |
+
- **Specialized Vocabulary:** May struggle with highly technical terms outside training domains
|
| 266 |
+
- **Context Length:** Maximum 512 tokens (typical for MarianMT)
|
| 267 |
+
- **Informal Language:** Performance may vary on heavy slang or very informal text
|
| 268 |
+
|
| 269 |
+
### Recommended Use Cases
|
| 270 |
+
- General Swahili-English translation
|
| 271 |
+
- Crisis hotline and helpline support
|
| 272 |
+
- Child protection conversations
|
| 273 |
+
- Educational content
|
| 274 |
+
- News and media translation
|
| 275 |
+
|
| 276 |
+
### Not Recommended For
|
| 277 |
+
- English β Swahili translation (use dedicated model)
|
| 278 |
+
- Medical/legal documents requiring 100% accuracy
|
| 279 |
+
- Real-time interpretation without human oversight
|
| 280 |
+
- Highly technical scientific papers
|
| 281 |
+
- Documents exceeding 512 tokens without chunking
|
| 282 |
+
|
| 283 |
+
## Ethical Considerations
|
| 284 |
+
|
| 285 |
+
### Intended Use
|
| 286 |
+
This model is designed to support:
|
| 287 |
+
- **Helpline operators** translating crisis communications
|
| 288 |
+
- **Child protection services** handling multilingual cases
|
| 289 |
+
- **General translation needs** in Swahili-speaking regions
|
| 290 |
+
|
| 291 |
+
### Potential Risks
|
| 292 |
+
- **Translation Errors:** May produce incorrect translations; human review recommended for critical applications
|
| 293 |
+
- **Bias:** May reflect biases present in training data
|
| 294 |
+
- **Crisis Situations:** Should not replace trained human operators in life-threatening emergencies
|
| 295 |
+
- **Privacy:** Ensure compliance with data protection regulations when processing sensitive content
|
| 296 |
+
|
| 297 |
+
### Responsible Use Guidelines
|
| 298 |
+
1. Always have human oversight for crisis/emergency translations
|
| 299 |
+
2. Do not rely solely on automated translation for legal or medical decisions
|
| 300 |
+
3. Be aware of cultural context that may not be captured in direct translation
|
| 301 |
+
4. Regularly evaluate performance on your specific use case
|
| 302 |
+
5. Implement appropriate safeguards for sensitive content
|
| 303 |
+
|
| 304 |
+
## Training Pipeline Details
|
| 305 |
+
|
| 306 |
+
### Dataset Preparation Flow
|
| 307 |
+
```
|
| 308 |
+
Raw Data β Token Filtering β Deduplication β Domain Tagging β
|
| 309 |
+
Tokenization β Train/Val Split β Training
|
| 310 |
+
```
|
| 311 |
+
|
| 312 |
+
### Training Flow
|
| 313 |
+
```
|
| 314 |
+
Load Base Model β Add Domain Tags β Load Datasets β
|
| 315 |
+
Apply Filtering β Baseline Evaluation β Training Loop β
|
| 316 |
+
Domain Evaluation (every 2000 steps) β Final Evaluation β
|
| 317 |
+
Save and Register Model
|
| 318 |
+
```
|
| 319 |
+
|
| 320 |
+
### Quality Filters Applied
|
| 321 |
+
- Minimum length: 3 tokens
|
| 322 |
+
- Maximum length: 512 tokens
|
| 323 |
+
- Maximum length ratio: 3.5:1
|
| 324 |
+
- Duplicate removal
|
| 325 |
+
- Encoding validation
|
| 326 |
+
|
| 327 |
+
## Reproducibility
|
| 328 |
+
|
| 329 |
+
### Experiment Tracking
|
| 330 |
+
All training runs tracked with:
|
| 331 |
+
- MLflow experiment tracking
|
| 332 |
+
- Versioned configuration files
|
| 333 |
+
- Dataset composition statistics
|
| 334 |
+
- Training metrics logging
|
| 335 |
+
- Model checkpoints and metadata
|
| 336 |
+
|
| 337 |
+
### Random Seeds
|
| 338 |
+
- Data shuffling seed: 42
|
| 339 |
+
- Train/test split seed: 42
|
| 340 |
+
- Deterministic training where possible
|
| 341 |
+
|
| 342 |
+
### Configuration
|
| 343 |
+
Complete training configuration available in repository:
|
| 344 |
+
- `configs/swahili_v1.json`: Full hyperparameters
|
| 345 |
+
- Training scripts with all optimization flags
|
| 346 |
+
- Dataset preparation pipeline
|
| 347 |
+
|
| 348 |
+
## Citation
|
| 349 |
+
|
| 350 |
+
If you use this model in your research or applications, please cite:
|
| 351 |
```bibtex
|
| 352 |
+
@misc{ogutu2025swahili-en-general-expanded,
|
| 353 |
+
author = {Ogutu, Brenda},
|
| 354 |
+
title = {Swahili-English General Domain Translation Model with Helpline Specialization},
|
| 355 |
+
year = {2025},
|
| 356 |
+
publisher = {HuggingFace},
|
| 357 |
+
journal = {HuggingFace Model Hub},
|
| 358 |
+
howpublished = {\url{https://huggingface.co/brendaogutu/sw-en-opus-mt-general-expanded}},
|
| 359 |
+
note = {Fine-tuned with domain-aware training and knowledge distillation}
|
| 360 |
+
}
|
| 361 |
```
|
| 362 |
|
| 363 |
## License
|
| 364 |
|
| 365 |
+
This model inherits the Apache 2.0 license from Helsinki-NLP/opus-mt-mul-en.
|
| 366 |
+
|
| 367 |
+
## Acknowledgments
|
| 368 |
+
|
| 369 |
+
- **Base Model:** Helsinki-NLP for the opus-mt architecture
|
| 370 |
+
- **Training Data:** CCAligned corpus for general translations
|
| 371 |
+
- **Helpline Data:** OpenCHs helpline conversation dataset
|
| 372 |
+
- **Framework:** Hugging Face Transformers, PyTorch
|
| 373 |
+
- **Experiment Tracking:** MLflow
|
| 374 |
+
|
| 375 |
+
## Contact and Support
|
| 376 |
+
|
| 377 |
+
- **Issues:** Open an issue on the model repository
|
| 378 |
+
- **Questions:** Contact via Hugging Face discussions
|
| 379 |
+
- **Updates:** Follow the model page for new versions
|
| 380 |
+
|
| 381 |
+
## Version History
|
| 382 |
+
|
| 383 |
+
- **v2.0** (Current): General domain expansion with knowledge distillation
|
| 384 |
+
- **v1.0:** Initial helpline-specialized model (openchs/sw-en-opus-mt-mul-en-v1)
|
| 385 |
+
|
| 386 |
+
---
|
| 387 |
|
| 388 |
+
**Last Updated:** December 2024
|
| 389 |
|
| 390 |
+
**Model Card Authors:** Brenda Ogutu (OpenCHs)
|