Practical overview
When it fits
Use PhoBERT when a project needs pretrained Vietnamese language representations and can prepare text in the expected word-segmented format.
Who it is for
- Developers building Vietnamese-language NLP applications.
- Researchers working on Vietnamese named-entity recognition, natural-language inference, part-of-speech tagging or dependency parsing.
Documented uses
- Load pretrained Vietnamese model features in a Transformers application.
- Use PhoBERT in a fairseq workflow.
- Prepare raw Vietnamese text for model input through word segmentation.
- Build downstream Vietnamese NLP tasks around the pretrained models.
Requirements & limits
- Transformers examples use vinai/phobert-base and require word-segmented input.
- The listed model variants have a maximum length of 256.
- The base and large checkpoints are listed with MIT terms; base-v2 is listed with GNU AGPL v3 terms.
- The repository asks users to cite the paper when PhoBERT contributes to published results or is incorporated into software.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Load a word-segmented Vietnamese sentence with Transformers
Prepare a segmented sentence and obtain PhoBERT model features using the repository’s Transformers example.
Before you start
- Install transformers and tokenizers.
- Use the vinai/phobert-base checkpoint.
- Provide Vietnamese text that is already word-segmented.
Steps
Load AutoModel and AutoTokenizer from transformers using vinai/phobert-base.
Encode a word-segmented sentence with the tokenizer.
Pass the encoded input to the model under torch.no_grad() to obtain features.
Expected outcome
The example returns model features for the encoded sentence.
Guide limitations
- Raw Vietnamese input must first be word-segmented.
- The example uses a 256-token maximum-length model variant.
- The documented integration does not establish compatibility with every Transformers version or application.
Segment raw Vietnamese text with VnCoreNLP
Convert raw Vietnamese text into word-segmented sentences for a PhoBERT workflow.
Before you start
- Install py_vncorenlp.
- Provide a local directory path for downloaded VnCoreNLP components.
Steps
Download VnCoreNLP components with py_vncorenlp.download_model and a local save directory.
Load VnCoreNLP with the wseg annotator and that directory.
Pass raw Vietnamese text to word_segment.
Expected outcome
The example produces word-segmented sentences that can be used as PhoBERT input.
Guide limitations
- The repository recommends the RDRSegmenter used in PhoBERT preprocessing; other segmenters are not evaluated in this guidance.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- VinAIResearch/PhoBERT · Official homepage title · retained in its source language

