KyawSu/nllb-en-my-workplace-safety
language:
- en
- my license: cc-by-nc-4.0 basemodel: facebook/nllb-200-distilled-600M pipelinetag: translation library_name: transformers tags:
- translation
- myanmar
- burmese
- nllb ---
NLLB English-Myanmar Translation Model (Fine-tuned)
An English-to-Myanmar translation model, fine-tuned from NLLB-200, explored for potential application in workplace-safety communication (e.g., for the Myanmar migrant worker community in Singapore).
Model Description
This model fine-tunes facebook/nllb-200-distilled-600M on a general-domain English-Myanmar parallel corpus. It was not trained on a dedicated workplace-safety dataset — it is a general-purpose translation model that was evaluated using workplace-safety example sentences to assess its potential fit for that use case.
Training Details
- Base model: facebook/nllb-200-distilled-600M (0.6B parameters)
- Training data: ALT (Asian Language Treebank), general/news-domain English-Myanmar parallel corpus
- Training samples: 18,082
- Validation samples: 1,000
- Test samples: 1,017 (available; not fully used in current evaluation — see below)
- Training configuration:
- Learning rate: 2e-5, with
reduce_lr_on_plateauscheduler - Effective batch size: 8 (per-device batch size 4 x gradient accumulation 2)
- Gradient checkpointing enabled
- Early stopping (patience = 2 epochs on validation loss)
- Max epochs: 10 (best result at epoch 7)
- Hardware: Google Colab (T4 GPU)
- Best checkpoint: Epoch 7, validation loss 0.680
Evaluation Results
Evaluated on a random sample of 100 sentences from the ALT test split (not the full 1,017-sentence test set).
*Standard word-level BLEU on this same sample was ~11.6 — the large gap reflects Myanmar word-segmentation mismatches with sacrebleu's default tokenizer, not a difference in translation quality. chrF and the custom character-level score are reported because they are more appropriate for Myanmar script.
Training Pipeline
ALT Dataset → Data Cleaning (null/empty filtering) → NLLB Tokenization (eng_Latn / mya_Mymr)
→ Fine-tuning (early stopping + LR scheduling) → Validation → Best Checkpoint Selection → Hugging Face UploadUsage
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("KyawSu/nllb-en-my-workplace-safety")
model = AutoModelForSeq2SeqLM.from_pretrained("KyawSu/nllb-en-my-workplace-safety")
def translate(text):
tokenizer.src_lang = "eng_Latn"
inputs = tokenizer(text, return_tensors="pt")
forced_bos_token_id = tokenizer.convert_tokens_to_ids("mya_Mymr")
generated_tokens = model.generate(**inputs, forced_bos_token_id=forced_bos_token_id, max_length=128)
return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
print(translate("Please wear your safety helmet at all times on the construction site."))Example output (actually generated by this model):
Input: Please wear your safety helmet at all times on the construction site.
Output: ကျေးဇူးပြု၍ ဆောက်လုပ်ရေး လုပ်ငန်းခွင် တွင် အချိန်တိုင်း တွင် သင် ၏ လုံခြုံရေး ဦးထုပ် ကို ဝတ်ဆင်ပါ ။Intended Use
This is a portfolio/demonstration project. It is not validated for production or safety-critical deployment.
⚠️ Important limitations:
- Trained on general news-domain text (ALT), not workplace-safety-specific text
- Not validated by professional or native Myanmar translators
- Not checked against official Singapore MOM (Ministry of Manpower) terminology standards
- Evaluation used a 100-sentence sample, not the full test set
Any real-world safety communication use would require review and correction by a qualified native Myanmar speaker, given the risk of mistranslation in safety-critical contexts.
Author
Built as an NLP portfolio project exploring English-Myanmar translation, with an eye toward eventual application for the Myanmar migrant worker community in Singapore.
