Practical overview
When it fits
Use MacBERT when a Chinese NLP project needs a BERT-style pretrained checkpoint and the team plans to build or fine-tune the downstream task system.
Who it is for
- Developers building Chinese-language NLP systems
- Researchers adapting pretrained models to downstream Chinese NLP tasks
Documented uses
- Load a pretrained Chinese language model as a starting point for NLP development
- Fine-tune a checkpoint for text classification or named-entity recognition
- Adapt a pretrained backbone for sentence-pair tasks
Requirements & limits
The repository identifies the project as open source under the Apache-2.0 license. It lists base and large checkpoints for download.
- The base checkpoint has 102 million parameters and a listed size of 383 MB; the large checkpoint has 324 million parameters and a listed size of 1.2 GB.
- The documented loading path uses Hugging Face Transformers with BertTokenizer and BertModel.
- MacBERT's pretraining substitutes similar words for [MASK] tokens and also applies whole-word and N-gram masking.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Load a MacBERT checkpoint with Transformers
Load the documented base or large MacBERT model using the BERT tokenizer and model classes.
Before you start
- Hugging Face Transformers
- A selected MacBERT checkpoint: base or large
Steps
Choose the base checkpoint, hfl/chinese-macbert-base, or the large checkpoint, hfl/chinese-macbert-large.
Load the tokenizer with BertTokenizer.from_pretrained using the chosen model name.
Load the model with BertModel.from_pretrained using the same model name.
Expected outcome
The selected MacBERT tokenizer and model are loaded through the documented Transformers interface.
Guide limitations
- The README's loading example covers model and tokenizer loading; it does not provide an end-to-end downstream fine-tuning recipe.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- ymcui/MacBERT · Official homepage title · retained in its source language

