A joint Word Segmentation (WS) and Part-of-Speech (POS) Tagging model for the Myanmar (Burmese) language, built on top of MyanBERTa-Legal-Finetuned with an Asymmetric BiLSTM + Dual CRF head architecture.
Model Architecture
MyanBERTa-Legal (RoBERTa-based, 768-dim)
+ Position Embedding (64-dim, syllable position from sentence end)
→ Concatenated (832-dim)
→ Asymmetric BiLSTM:
Forward LSTM: 832 → 256
Backward LSTM: 832 → 512
→ Concatenated output (768-dim)
→ Dual Heads:
Head 1 (WS): Linear(768 → 4) + CRF [B, I, E, S]
Head 2 (POS): Linear(768 → 68) + CRF [B/I/E/S-UPOS]
Total Parameters: 112,858,104
Mixed Precision: FP16 (AMP)
Training Hardware: 2× NVIDIA Tesla T4 (DataParallel)
Training Data
Dataset:finalanalyzedposxpos.conllu
Format: CoNLL-U, converted to syllable-level BIES tags
Loss: CRF loss + 0.3 × Cross-Entropy auxiliary loss (both heads)
Class Weighting: WeightedRandomSampler (4× boost for rare POS tags: AUX, INTJ, SYM, PROPN, SCONJ, DET, X)
Training Progress (Validation Combined F1 per Epoch)
Epoch
Loss
WS F1
POS F1
Combined F1
1
73.6700
0.8871
0.7974
0.8333
2
25.0627
0.9055
0.8418
0.8673
3
18.7039
0.9180
0.8636
0.8853
4
15.6097
0.9213
0.8656
0.8879
5
13.4530
0.9249
0.8718
0.8930
6
11.9508
0.9268
0.8762
0.8964
7
10.8137
0.9283
0.8787
0.8985
8
9.6801
0.9287
0.8811
0.9001
9
8.9287
0.9293
0.8821
0.9010 ✓ Best
10
8.2989
0.9290
0.8794
0.8992
11
10.0370
0.9231
0.8679
0.8900
12
12.8928
0.9208
0.8631
0.8862
Usage
This model uses a custom architecture and is not compatible with the standard transformerspipeline(). You need the JointSegPosModel class and a syllable segmentation function. Below is an example using the model files provided in this repository.
python
1import torch
2import json
3from transformers import AutoTokenizer
45# --- Define syllable_segment (example: split on space or use your own segmenter) ---6defsyllable_segment(text):7"""Split text into syllable-level tokens. Replace with your actual syllable segmenter."""8return text.split()910# Load label maps11withopen("wsid2label.json")as f:12 wsid2label ={int(k): v for k, v in json.load(f).items()}13withopen("posid2label.json")as f:14 posid2label ={int(k): v for k, v in json.load(f).items()}15withopen("wslabel2id.json")as f:16 wslabel2id = json.load(f)17withopen("poslabel2id.json")as f:18 poslabel2id = json.load(f)1920tokenizer = AutoTokenizer.from_pretrained("UCSYNLP/MyanBERTa")2122# Build model (JointSegPosModel class required from training code)23model = JointSegPosModel(24"sithu015/MyanBERTa-legal-finetuned",25 num_ws_labels=len(wslabel2id),26 num_pos_labels=len(poslabel2id)27)28model.load_state_dict(torch.load("bestmodel.pt", map_location="cpu"))29model.eval()3031# Tokenize and predict32syllables = syllable_segment("ကို၏ နာမည် မှာ ကိုကို ဖြစ်သည်")# syllable-level list33encoding = tokenizer(34 syllables,35 is_split_into_words=True,36 return_tensors="pt",37 truncation=True,38 max_length=300,39 padding="max_length"40)4142with torch.no_grad():43 ws_preds, pos_preds = model(encoding["input_ids"], encoding["attention_mask"])
Files
File
Description
bestmodel.pt
Trained model weights (PyTorch)
wslabel2id.json
WS label → ID mapping
wsid2label.json
WS ID → label mapping
poslabel2id.json
POS label → ID mapping
posid2label.json
POS ID → label mapping
modelmetadata.json
Training metadata and results
config.json
Model configuration
Citation
If you use this model, please cite:
bibtex
1@misc{sithu015-myanberta-bilstm-crf-joint-2026,
2 author = {Sithu Aung},
3 title = {MyanBERTa-BiLSTM-CRF-Joint: Joint Word Segmentation and POS Tagging for Myanmar},
4 year = {2026},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/sithu015/MyanBERTa-BiLSTM-CRF-Joint}
7}