The model achieved 0.90268 on the public leaderboard, (winner's score is 0.90087)
Bert4news is used for a toolkit Vietnames(segmentation and Named Entity Recognition) at ViNLPtoolkit(
https://github.com/bino282/ViNLP
)
We use word sentencepiece, use basic bert tokenization and same config with bert base with lowercase = False.
import torch
from transformers import BertTokenizer,BertModel
tokenizer= BertTokenizer.from_pretrained("NlpHUST/vibert4news-base-cased")
bert_model = BertModel.from_pretrained("NlpHUST/vibert4news-base-cased")
line = "Tôi là sinh viên trường Bách Khoa Hà Nội ."
input_id = tokenizer.encode(line,add_special_tokens = True)
att_mask = [int(token_id > 0) for token_id in input_id]
input_ids = torch.tensor([input_id])
att_masks = torch.tensor([att_mask])
with torch.no_grad():
features = bert_model(input_ids,att_masks)
print(features)
Vietnamese toolkit with bert
ViNLP is a system annotation for Vietnamese, it use pretrain
Bert4news
to fine-turning to NLP problems in Vietnamese components of wordsegmentation,Named entity recognition (NER) and achieve high accuravy.
Installation
git clone https://github.com/bino282/ViNLP.git
cd ViNLP
python setup.py develop build
Test Segmentation
The model achieved F1 score : 0.984 on VLSP 2013 dataset
Model
F1
BertVnTokenizer
98.40
DongDu
96.90
JvnSegmenter-Maxent
97.00
JvnSegmenter-CRFs
97.06
VnTokenizer
97.33
UETSegmenter
97.87
VnTokenizer
97.33
VnCoreNLP (i.e. RDRsegmenter)
97.90
from ViNLP import BertVnTokenizer
tokenizer = BertVnTokenizer()
sentences = tokenizer.split(["Tổng thống Donald Trump ký sắc lệnh cấm mọi giao dịch của Mỹ với ByteDance và Tecent - chủ sở hữu của 2 ứng dụng phổ biến TikTok và WeChat sau 45 ngày nữa."])
print(sentences[0])
Tổng_thống Donald_Trump ký sắc_lệnh cấm mọi giao_dịch của Mỹ với ByteDance và Tecent - chủ_sở_hữu của 2 ứng_dụng phổ_biến TikTok và WeChat sau 45 ngày nữa .
Test Named Entity Recognition
The model achieved F1 score VLSP 2018 for all named entities including nested entities : 0.786
Model
F1
BertVnNer
78.60
VNER Attentive Neural Network
77.52
vietner CRF (ngrams + word shapes + cluster + w2v)
76.63
ZA-NER BiLSTM
74.70
from ViNLP import BertVnNer
bert_ner_model = BertVnNer()
sentence = "Theo SCMP, báo cáo của CSIS với tên gọi Định hình Tương lai Chính sách của Mỹ với Trung Quốc cũng cho thấy sự ủng hộ tương đối rộng rãi của các chuyên gia về việc cấm Huawei, tập đoàn viễn thông khổng lồ của Trung Quốc"
entities = bert_ner_model.annotate([sentence])
print(entities)
For personal communication related to this project, please contact Nha Nguyen Van (
[email protected]
).
Runs of NlpHUST vibert4news-base-cased on huggingface.co
791
Total runs
37
24-hour runs
124
3-day runs
204
7-day runs
239
30-day runs
More Information About vibert4news-base-cased huggingface.co Model
vibert4news-base-cased huggingface.co
vibert4news-base-cased huggingface.co is an AI model on huggingface.co that provides vibert4news-base-cased's model effect (), which can be used instantly with this NlpHUST vibert4news-base-cased model. huggingface.co supports a free trial of the vibert4news-base-cased model, and also provides paid use of the vibert4news-base-cased. Support call vibert4news-base-cased model through api, including Node.js, Python, http.
vibert4news-base-cased huggingface.co is an online trial and call api platform, which integrates vibert4news-base-cased's modeling effects, including api services, and provides a free online trial of vibert4news-base-cased, you can try vibert4news-base-cased online for free by clicking the link below.
NlpHUST vibert4news-base-cased online free url in huggingface.co:
vibert4news-base-cased is an open source model from GitHub that offers a free installation service, and any user can find vibert4news-base-cased on GitHub to install. At the same time, huggingface.co provides the effect of vibert4news-base-cased install, users can directly use vibert4news-base-cased installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
vibert4news-base-cased install url in huggingface.co: