ModernCantoneseBert-Large-Char
Character-level model for the Cantonese language
2 min readupdated
This model is a character-level version of ModernCantoneseBert-Large built on the ModernBERT architecture, fine-tuned using the masked language modeling (MLM) method on a corpus of Cantonese and Chinese texts. The main difference from the base version is the tokenizer: instead of BPE tokens covering whole words, each Chinese character strictly corresponds to a single token here. This makes the tool convenient for NLP tasks requiring character-level tokenization, such as named entity recognition (NER) or text segmentation in the Cantonese dialect.
Key features
- Character-level tokenizer of 12,160 tokens where each ideogram is separated from the others.
- Normalization of non-Chinese elements into special tokens like [URL], [EMAIL], [LATIN], and [NUM].
- Preservation of the 28-layer structure of the base ModernCantoneseBert-Large model with a context of up to 8,192 tokens.
- Fine-tuning on a filtered dataset of about 637 million tokens for 5 epochs.
What you can do
- Use the model in a fill-mask pipeline to restore missing characters in Cantonese texts.
- Apply weights for fine-tuning in NER tasks, span extraction, or text segmentation.
- Extract text features for Cantonese language research projects.
Example
from transformers import pipeline
mask_filler = pipeline(
"fill-mask",
model="hon9kon9ize/ModernCantoneseBert-Large-Char"
)
mask_filler("香港特首係李家[MASK]。")Read more
DetailsParameters: 356.7 million
Benchmarks: Loss 0.9725, Accuracy 0.7807, Perplexity 2.64
Training: 4 × NVIDIA H100 80GB, batch size of 32 sequences of 2,048 tokens
Limitations: for research purposes only, tokenization with loss of spaces and original form of special tokens










Comments