Practical overview
When it fits
Use it when a Chinese NLP project calls for pretrained XLNet weights and you want to select between the listed base and mid checkpoints, or consult the repository’s reported baselines for reading comprehension and sentiment classification.
Who it is for
- Researchers exploring pretrained models for Chinese-language NLP.
- Developers prototyping Chinese NLP systems or fine-tuning pretrained weights for domain-specific text tasks.
- Teams comparing XLNet checkpoints on Chinese reading-comprehension or sentiment-classification tasks.
Documented uses
- Load pretrained Chinese XLNet weights as a starting point for an NLP prototype.
- Fine-tune a checkpoint for a domain-specific Chinese text task.
- Compare XLNet-base and XLNet-mid with other pretrained Chinese models on a task dataset.
Requirements & limits
- The available sizes differ substantially: XLNet-base has 12 layers and 117 million parameters; XLNet-mid has 24 layers and 209 million parameters.
- The README gives different download routes by framework: Hugging Face for PyTorch and Baidu Netdisk for TensorFlow.
- The documented quick-loading method uses Transformers AutoTokenizer and AutoModel with the model names hfl/chinese-xlnet-base and hfl/chinese-xlnet-mid.
- The README identifies the XLNet-mid pretraining corpus as Chinese Wikipedia plus general data totaling 5.4 billion words.
- Reported benchmark results cover selected datasets and tasks, so they do not establish expected results on other data.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Load a Chinese XLNet checkpoint with Transformers
Load one of the repository’s named Hugging Face checkpoints using the documented Transformers interface.
Before you start
- Python environment with the Transformers library; the README’s quick-loading instructions refer to Transformers 2.2.2.
- Choose the checkpoint name hfl/chinese-xlnet-base or hfl/chinese-xlnet-mid.
Steps
Set MODEL_NAME to hfl/chinese-xlnet-base or hfl/chinese-xlnet-mid.
Use AutoTokenizer.from_pretrained(MODEL_NAME) to load the tokenizer.
Use AutoModel.from_pretrained(MODEL_NAME) to load the model.
Expected outcome
The tokenizer and pretrained model are loaded through the documented AutoTokenizer and AutoModel interface.
Guide limitations
- The README’s quick-loading example documents loading, not task-specific fine-tuning or inference steps.
- The README cites Transformers 2.2.2; it does not establish compatibility with other versions.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- ymcui/Chinese-XLNet · Official homepage title · retained in its source language

