Views
No views yet
@article{phobert,
title = {{PhoBERT: Pre-trained language models for Vietnamese}},
author = {Dat Quoc Nguyen and Anh Tuan Nguyen},
journal = {Findings of EMNLP},
year = {2020}
}transformers:
- git clone https://github.com/huggingface/transformers.git
- cd transformers
- pip3 install --upgrade .| Model | #params | Arch. | Pre-training data |
|---|---|---|---|
vinai/phobert-base | 135M | base | 20GB of texts |
vinai/phobert-large | 370M | large | 20GB of texts |
1import torch
2from transformers import AutoModel, AutoTokenizer
3
4phobert = AutoModel.from_pretrained("vinai/phobert-base")
5tokenizer = AutoTokenizer.from_pretrained("vinai/phobert-base")
6
7# INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
8line = "Tôi là sinh_viên trường đại_học Công_nghệ ."
9
10input_ids = torch.tensor([tokenizer.encode(line)])
11
12with torch.no_grad():
13 features = phobert(input_ids) # Models outputs are now tuples
14
15## With TensorFlow 2.0+:
16# from transformers import TFAutoModel
17# phobert = TFAutoModel.from_pretrained("vinai/phobert-base")